×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    4

    Question JQuery.ajax onerror function doesn't fire on the device

    Hello guys,

    I have an application that requires to make an Ajax synchronization on the server. I'm using the JQuery.ajax function which works well on success but yesterday my server was returning an error (basically a 500 Internal Server Error) and the device was not showing the error message. Here is the code:

    Code:
    jQuery.ajax({
                contentType: 'application/json',
                type: 'post',
                processData: false,
                dataType: 'json',
                url: DWWG.syncUrl + '/api/v1/jsonrpc.php',
                cache: false,
                data: $.toJSON({
    				jsonrpc: '2.0',
    				method: 'synchronize',
    				params: [username, password, '[' + dataToSend.join(',') + ']', DWWG.preferences.purge, DWWG.preferences.fillWithLast],
    				id: 1
    			}),
                error: function(req,stat,err){
    				alert('An Error has ocurred');
                },
                success: function(inp){
    				// Success Code that works
                }
            });
    Please, can you tell me why in the emulator (Aptana) the error message is displayed but not on a real device (N95) ?

  2. #2
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: JQuery.ajax onerror function doesn't fire on the device

    what version of jquery are you using? the implementation of javascript is probably not quite the same between your device and your emulator.
    i assume the success function was not called either?

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    4

    Re: JQuery.ajax onerror function doesn't fire on the device

    I'm using the version 1.3.2 on the emulator and on the device. The success funcion is called when the response doesn't contain errors, but the error function isn't called when in the server a error happens.
    Last edited by dasaevc; 2010-12-09 at 22:26. Reason: More explanation

  4. #4
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: JQuery.ajax onerror function doesn't fire on the device

    i would suggest using the mobile version of jquery: http://jquerymobile.com/ which is supposed to be more compatible with mobile javascript engines

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    4

    Re: JQuery.ajax onerror function doesn't fire on the device

    Thanks for your reply,

    As fas as I know the jQuery mobile is an extension of the jQuery library not a modified version of it. Probably I'm doing something wrong, I'll review again my code and if i don't find something I'll try with this library.

Similar Threads

  1. Who can help to solve reboot device function
    By sd_liuwei in forum Symbian
    Replies: 4
    Last Post: 2010-03-10, 09:57
  2. jQuery show() and hide() do not work on device.
    By chrisrauh in forum Symbian
    Replies: 5
    Last Post: 2008-11-18, 22:44
  3. Replies: 2
    Last Post: 2008-11-14, 21:32
  4. What we want is a basic function device.
    By hendrysong in forum General Development Questions
    Replies: 1
    Last Post: 2008-06-06, 04:02
  5. Fire key on touch screen device?
    By girdhar in forum Mobile Java General
    Replies: 1
    Last Post: 2008-03-25, 09:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×