$. Get () is always unsuccessful

Source: Internet
Author: User
$. Get () always failed & nbsp; $ (document ). ready (function () {& nbsp; & nbsp; & nb $. get () always failed
$ (Document). ready (function (){
$ ("# New"). click (function (){
Var order1 = document. getElementById ("new1"). value;

$. Get ("obj_search.php", {order: order1}, function (response)
{
$ ("# Show" response .html (response );
})
});
});
This is the paragraph, the value is always not passed, and no value is passed during the operation. I have been using this method to write all the data. why is this always unsuccessful, I am at $. you have added alert (order1) before get (); you can run it to $. get () is not executed,

Recently, my graduation project has become crazy and I don't know much about WEB development ~~~~~~
------ Solution --------------------
Alert (response); print this to see if there is any result set
------ Solution --------------------
How can I not directly obtain the id using jquery?
$ ("# New1"). val ();
By the way, is your ajax URL correct?
------ Solution --------------------
$. Get ("obj_search.php", {"order": order1}, function (response)
------ Solution --------------------
You can use the google browser to view what is in the http request. Have you returned what you want? You can also directly access obj_search.php? Order = parameter to see what value is returned.
------ Solution --------------------
Check whether there are network requests when you click in the browser.

If yes, check whether the request address is incorrect or the return value is abnormal.

------ Solution --------------------
1. confirm that your page is running from the server
2. the standard format is
$(document).ready(function(){
$("#new").click(function(){
var order1 = $("#new1").value;
$.get("obj_search.php",{order:order1},function(response) {
$("#show").html(response);
})
});
});

3. you can watch alert (order1) after obtaining order1.
4. run http: // localhost/obj_search.php directly in the browser? Order = 1
------ Solution --------------------
How did you write your obj_search.php?

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.