tags:

views:

2601

answers:

2

I'm trying to figure the result of this call if it was successful or not. The successFunction doesn't get called so i'm assuming it was not. How do i know what went wrong?

xmlRequest = $.post("/url/file/", { 'id' : object.id }, successFunction, 'json');

Do i use the xmlRequest object?

+5  A: 

You could use the $.ajaxComplete() and/or $.ajaxError() methods to attach function to those events. I would also recommend using the Firefox browser with the Firebug pluging, you can get a lot of information about the requests and responses.

palehorse
I wasn't able to get this to work, i tried using the example on jquery's page with no success
SeanDowney
+7  A: 

You can use:

$.ajax({
    url:"/url/file/",
    dataType:"json"
    data:{ 'id' : object.id }
    error:function(request){alert(request.statusText)}
    success:successFunction
})
defrex