-2

Will toDistance.php ran after calling this function? It seems like toDistance.php is not called. Thanks

function myAjax(volunteerDist, jid){
            $.ajax({
            type:'POST',
            url: 'toDistance.php',
            data : ({
                distance:volunteerDist,
                id:jid
            }),
            success: function(){
                 alert('worked');
            },
               error :function(jqXHR, textStatus, errorThrown) {
                alert(errorThrown);
            },
           complete : function(){
               alert('thanks');
           }
        });
Brandon Young
  • 523
  • 2
  • 8
  • 19
  • @JoeTuskan in my toDistance.php, I had an echo, but it did not do so, how come? – Brandon Young Mar 15 '12 at 18:00
  • Because it's ajax. not a page refresh. – Joe Mar 15 '12 at 18:01
  • @JoeTuskan okay, now, volunteerDist and jid are arrays, how can I $_GET it in my toDistance.php? – Brandon Young Mar 15 '12 at 18:02
  • You need to make more "home-work" before posting a question. **What do you see in firebug?** stackoverflow isn't a "charades game" kind of place – gdoron Mar 15 '12 at 18:04
  • i am sorry.. i do not know firebug.. it just knew about this today and read about this $_GET – Brandon Young Mar 15 '12 at 18:08
  • SO, if you already know firebug, fiddler, etc. what do you see in there? See this ->http://stackoverflow.com/questions/4263116/wireshark-vs-firebug-vs-fiddler-pros-and-cons – jose Mar 16 '12 at 09:24

3 Answers3

1

Did you tried out by taking arguments on your success function? Try this code.

function myAjax(volunteerDist, jid){
            $.ajax({
            type:'POST',
            url: 'toDistance.php',
            success: function( data ){
            ///CHECK UR UPCOMING DATA
                 alert(data.jid);
                 alert('worked');
            },
               error :function(jqXHR, textStatus, errorThrown) {
                alert(errorThrown);
            },
           complete : function(){
               alert('thanks');
           }
        });
Hamza Waqas
  • 629
  • 4
  • 12
0

Will toDistance.php ran after calling this function?

If the data parameter is what the server expecting to get, Yes.

Use firebug, check what is going on with your request and stop guessing...

gdoron
  • 147,333
  • 58
  • 291
  • 367
0

It seems OK. Try to track web traffic with FIddler and check if the script is called and the arguments.

If you're debbuging with Safari, Chrome or Firefox you can record the traffic. Check for POST variables, script location etc.

jose
  • 2,733
  • 4
  • 37
  • 51