facebook

jQuery Ajax response not working – ajax.done

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #324112 Reply

    alexbernal
    Member

    I have the following code and it will execute the php script fine, but it will not process the response back from the server. I have tested the php script by itself and it is returning a response. Any ideas why this is happening?

    phoneui.contactFormSubmit = function(){
    var cname=$(‘#m1-contactus-cname’).val();
    var cemail=$(‘#m1-contactus-cemail’).val();
    var cmsg=$(‘#m1-contactus-cmsg’).val();
    var ar=$.ajax({
    type: ‘GET’,
    url: ‘http://barcodedauctions.com/php/controller.php’,
    data: ‘action=eum&cname=’+escape(cname)+’&cemail=’+escape(cemail)+’&cmsg=’+escape(cmsg)
    }).done(function(msg){
    if(msg!=’success’){
    alert(msg);
    }else{
    alert(‘Message Sent!’);
    $(‘#m1-contactus-cname’).val(”);
    $(‘#m1-contactus-cemail’).val(”);
    $(‘#m1-contactus-cmsg’).val(”);
    }
    });
    }

    #324114

    support-michael
    Keymaster

    @alexbernal

    Are you receiving any error msgs? My 1st thought is a cross domain violation. Are you loading all of the webapp content from the server that you are posting to?

    #324118

    alexbernal
    Member

    You were right! That was the problem, although it did not generate any errors. However, is there a way to be able to use the Test Center to test my code without having to load the code to my server every time?

    #324120

    support-michael
    Keymaster

    @alexbernal

    Let’s see, can you try disabling the local webserver from Window>Settings? Then rerun your webapp in the Test Center. This will load your webapp from your disk (file:\\ protocol) which I believe is not restricted to the traditional cross domain restrictions. Also, you can pass an error handler to the jquery ajax function that should give you some access to http or xhtmlrequest object… just say’n

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: jQuery Ajax response not working – ajax.done

You must be logged in to post in the forum log in