$.get () always performs unsuccessfully

Source: Internet
Author: User
$ (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?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.