$ (document). Ready (function () {
$ ("#new"). Click (function () {
var Order1=document.getelementbyid ("New1"). Value;
$.get ("obj_search.php", {order:order1},function (response)
{
$ ("#show"). HTML (response);
})
});
});
This is the paragraph, the value is always passed, when the operation of the time there is no value, I have been written in this way can be transmitted, why this is always running unsuccessful, I $.get () before the alert (order1), can run on the $.get () will not be executed,
Recently was the graduation design to go crazy, web development knows not much, hope everyone enlighten ~~~~~~
Reply to discussion (solution)
Dot review element inside of the network to see, nothing to pass through the page except the original picture what
alert (response); Print this and see if there's a result set.
How do I not get ID directly with jquery?
$ ("#new1"). Val ();
By the way, is your Ajax URL correct?
$.get ("obj_search.php", {"Order": order1},function (response)
Use Google Chrome to see what is in the HTTP request, whether to return what you want, or to directly access the obj_search.php?order= parameter to see what value is returned.
Use the browser to see if there is a network request at the time of the click.
If so, see if the requested address is incorrect, or if the return value is abnormal
Use the browser to see if there is a network request at the time of the click.
If so, see if the requested address is incorrect, or if the return value is abnormal
No network requests:
1. Verify that your page is running from the server
2, the code is the wording of
$ (document). Ready (function () { $ ("#new"). Click (function () { var order1 = $ ("#new1"). Value; $.get ("obj_search.php", {order:order1},function (response) { $ ("#show"). HTML (response); }) });
3, you can get order1 after the alert (order1) to watch
4. Run http://localhost/obj_search.php?order=1 directly with the browser
1. Verify that your page is running from the server
2, the code is the wording of
$ (document). Ready (function () { $ ("#new"). Click (function () { var order1 = $ ("#new1"). Value; $.get ("obj_search.php", {order:order1},function (response) { $ ("#show"). HTML (response); }) });
3, you can get order1 after the alert (order1) to watch
4. Run http://localhost/obj_search.php?order=1 directly with the browser
Alert is over, you can get order1 value.
So how did you write the obj_search.php?