您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

$.get()老是执行不成功

2025/1/8 5:41:03发布15次查看
$.get()总是执行不成功
 $(document).ready(function(){
                         $(#new).click(function(){
                          var order1=document.getelementbyid(new1).value;
$.get(obj_search.php,{order:order1},function(response)
                     {
                      $(#show).html(response);
                     })
                     });
                 });
就是这一段,值总是传不过去,运行的时候根本就没有传值,我一直用这个方法写的都可以传,为什么这个总是运行不成功呢,我在$.get()之前加过alert(order1);可以运行就到了$.get()就不执行,
最近快被毕业设计弄疯,web开发懂得也不多,望大家赐教~~~~~~
------解决方案--------------------
alert(response);打印这个看看有结果集没
------解决方案--------------------
用jquery怎么不直接获取id
$(#new1).val();
顺便看一下你的ajax的url是正确的么
------解决方案--------------------
$.get(obj_search.php,{“order”:order1},function(response)
------解决方案--------------------
用google浏览器查看http请求中都是啥,有没有返回你想要的东西,也可以直接访问obj_search.php?order=参数,看返回什么值。
------解决方案--------------------
用浏览器看下在点击的时候,是否有网络请求。
如果有的话,看下请求的地址是否错误,或者返回值是否异常
------解决方案--------------------
1、确认你的页面是从服务器上运行的
2、规范的写法是
$(document).ready(function(){
$(#new).click(function(){
var order1 = $(#new1).value;
$.get(obj_search.php,{order:order1},function(response) {
$(#show).html(response);
})
});
});
3、可在取得 order1 后 alert(order1) 观看一下
4、直接用浏览器运行 http://localhost/obj_search.php?order=1 
------解决方案--------------------
那你的 obj_search.php 是怎么写的?
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product