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 j开发者_JS百科queryControl
to insert it in the .ajax function and reload the data according to the new value entered.
Any idea to do that please ? Thanks
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({ ... }); });
精彩评论