Jump to content

jQuery ajax - .post() problem


kirill578

Recommended Posts

This code doesn't work/execute anything ( ajax_request.php works fine)

 

    $.post("ajax_request.php", { vote: "a", id: "2", category: "0" },
      function(data) {
      $("div#result_a_show").text("" + data.a);
      $("div#result_b_show").text("" + data.b);
      $('a#next_link').attr('href', data.link);
      }, "json");   

Link to comment
Share on other sites

 

i tried this. but now all the code doesn't working.

 

    $.post({
      url: 'ajax_request.php',
      data: { vote: 'b', id: '2', category: '0' }
      dataType: 'json',
      success: function(data) {
        $("div#result_a_show").text("" + data.a);
        $("div#result_b_show").text("" + data.b);
        $('a#next_link').attr('href', data.link);
      }
      });

Link to comment
Share on other sites

I downloaded FireBug. Is says that the POST send successful and it gets the right response but the problem has I already said before is that it doesn't execute the success function. I tried to add alert into it but i doesn't apper as well. ( My feeling that jQuery hates me  :'( )

Link to comment
Share on other sites

I have finally found out that the problem is the PHP file  ::)

its output starts in the third line..

 

could you maybe show what you mean by that, and what was the solution. sorry for asking but i am pretty eager to learn this :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.