$. 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?