M
M
Maxim2015-10-03 20:34:27
PHP
Maxim, 2015-10-03 20:34:27

jQuery AJAX GET How to pass multiple variables?

Hello!
i have code:

<a href="#" id ="'.$postrow['id'].'" static="12" class = "price">'.$postrow['id'].'</a> 

<script LANGUAGE="JavaScript" >
  $(document).ready(function(){ 
    $('.price').click(function(){ 
    var clkid = this.id; 
      $.ajax({ 
        type: "GET",
        url: "s33/info.php",
         data: "id="+clkid,
        success: function(html){ 
          $("#info3").html(html);
        }
      });
      return false; 
    });
  });
</script>


Everything works, how can I pass another static to ajax?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Immortal_pony, 2015-10-03
@Immortal_pony

data: {
    id: clkid,
    static: "something"
},

C
callback, 2015-10-03
@callback

replace data: "id="+clkid,with data: "id="+clkid+"&static=12345",to pass the number 12345 to static

V
veydlin, 2015-10-03
@veydlin

$(document).ready(function() {
    $('.price').click(function() {
        $.get('s33/info.php', { name: 'John', time: '2pm' }, function(data) {
            $('#info3').html(data);
        });
        return false;
    });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question