tags:

views:

27

answers:

1

Hello,

I'd like an input to control that :

jQuery.ajax({
   type: "get",
   dataType: "jsonp",
   url: "http://www.foo.com/something.php",
   data: {numberInput: "NUMBER I WANT TO CONTROL" },

On the HTML side I've

 <input type="text" id="jqueryControl" />

I want when a user enters a number into the jqueryControl to insert it in the .ajax function and reload the data according to the new value entered.

Any idea to do that please ? Thanks

+2  A: 

it's more like .ajax() to get the value. Given that code, it should be:

jQuery.ajax({
   type: "get",
   dataType: "jsonp",
   url: "http://www.foo.com/something.php",
   data: { numberInput: $('#jqueryControl').val() },
   ...});

Of course, you should trigger the ajax on somehow, for example on change using the event handler:

$('#jqueryControl').change(function(){ $.ajax({ ... }); });
Zlatev
perfect ;) thank you
Tristan