Jquery : Ajax data bằng phương thức Post dữ liệu là json

Truyền Ajax bình thường thì ta có thể đọc manual của Jquery tại đây :
http://api.jquery.com/jQuery.ajax/
Ở đây tôi muốn nói đến cách truyền 1 mảng data qua post :
Mảng data của tôi có dạng :

"id" : "1",
"name" : "2"


Code của tôi đại loại như sau :

<script>
$.ajax({
   type: "POST",
   data: {
      "id" : "1",
      "name" : "2"
   },
   url: "<?php echo $data['base_url']?>/ajax/get2.php",
   success:function(data){
      temp.html(data);
   }
});
</script>

Và code nhận là :

<?php echo $_POST['id']?><?php echo $_POST['name']?>

11 thoughts on “Jquery : Ajax data bằng phương thức Post dữ liệu là json

  1. Thanks , I have just been looking for information about this topic for a long time and yours is the best I have discovered till now. But, what concerning the bottom line? Are you positive concerning the supply?

  2. I’m no longer certain the place you’re getting your info, but good topic. I must spend a while finding out much more or figuring out more. Thank you for great info I used to be searching for this information for my mission.

  3. I think everything posted was very reasonable. But, think on this, what if you were to create a killer headline? I ain’t suggesting your information isn’t solid, however what if you added a headline that grabbed people’s attention? I mean Jquery : Ajax data bằng phương thức Post dữ liệu là json is a little plain. You might peek at Yahoo’s home page and see how they write news titles to grab viewers interested. You might try adding a video or a related picture or two to get readers excited about what you’ve got to say. In my opinion, it could make your posts a little bit more interesting.

  4. Dear all, thanks for your feedback. I always looking to hearing from you. I know my problem, but i want to keep everything simple and clean. When you have problem, you may be find solution at here. Another is my writing skill no good, I cannot write long article :(, but i will try next time.

  5. Wednesday, at Arena Corinthians, in Sao Paulo, Brazil, Argentina defeated Holland 4-2 on penalties after extra time, in a dour, scoreless game. As soon as fitted and also running, it will be easy to get a list of national in addition to world-wide TV channels from Australia, Argentina, Brazil, Canada, China, Denmark, France, Germany, Hong Kong, Italy, India, Japan, Kuwait, Mexico, New Zealand, Netherlands and Norway that you may view. This concern for life and law was, sadly, set aside during the long years of the Second World War by both sides.

  6. I just like the valuable information you provide on your articles. I’ll bookmark your blog and test once more here frequently. I am quite sure I’ll be told many new stuff proper here! Good luck for the next!

  7. When some one searches for his required thing, therefore he/she wants to be available that in detail, thus that thing is maintained over here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s