nick cruse
nick cruse

Reputation: 141

make jQuery post more than one query

i have a jQuery code that posts an ID to another php file

<script type="text/javascript">

$(function() {
   //More Button
   $('.more').live("click",function() {
      var ID = $(this).attr("id");

      if(ID){

         $("#more"+ID).html('<img src="moreajax.gif" />');

         $.ajax({
            type: "POST",
            url: "ajax_more.php",
            data: "lastmsg="+ ID, 
            cache: false,
            success: function(html){
                $("ol#updates").append(html);
                $("#more"+ID).remove();
            }
         });

   }else{
      $(".morebox").html('The End');   
   }    
   return false; 
   });
});

</script>

How can I make it post another query along with "last message id"? I have a MySQL query that will output a value (pid). How can I post this along with "last message id"?

Upvotes: 1

Views: 137

Answers (2)

pinarella
pinarella

Reputation: 895

Here is my solution:

var salji = {
  rate: score,
  image_id: img_id
};

$.ajax({
    type: "POST",
    url: "widgets/rate.php",
    data: salji,
    success: function(msg){
        alert('wow');
    }
});

Upvotes: 1

thecodeparadox
thecodeparadox

Reputation: 87083

$.ajax({
            type: "POST",
            url: "ajax_more.php",
            data: "lastmsg="+ ID + "&pid=" + your_pid, 
            cache: false,
            success: function(html){
                $("ol#updates").append(html);
                $("#more"+ID).remove();
            }
         });

Upvotes: 2

Related Questions