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

花清香茶新味 2014-05-20 05:14:16
$(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开发懂得也不多,望大家赐教~~~~~~
...全文
599 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
tony4geek 2014-05-22
  • 打赏
  • 举报
回复
jquery 没引用进来
同同 2014-05-22
  • 打赏
  • 举报
回复
好像不是这么写的啊!先绑定点击事件吧 $(“#id”).bind(“click”, function(){ $.get("obj_search.php",{class1:'jewelry'},function(response){ $("#show").html(response); });
花清香茶新味 2014-05-22
  • 打赏
  • 举报
回复
引用 13 楼 hlc0110 的回复:
页面上有这个div吗 <div id='news'></div> ,假如有 ,你点击了吗??全部代码贴出来!!!!
全部代码: <?php session_start();?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Her Designs</title> <link rel="stylesheet" href="css/style.css" type="text/css" /> <!--[if IE 6]> <link rel="stylesheet" href="css/ie6.css" type="text/css" /> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" href="css/ie7.css" type="text/css" /> <![endif]--> </head> <body> <div class="header"> <div> <a href="index.php" id="logo"><img src="images/logo.gif" alt="logo"/></a> <div class="navigation"> <ul class="first"> <li class="first"><a></a></li> <?php if (!empty($_SESSION['uname'])) { print '<li><a href="user_manage.php">'.$_SESSION['uname'].',欢迎您</a><a href="logout.php">/退出</a></li>'; }else{ print'<li><a href="login.php">登陆</a></li> <li><a href="signup.php">注册</a></li>'; } ?> </ul> </div> <form id="search" > <input type="text" id="keyword" /> <input type="button" id="submit" value="搜索" onclick="search1()" /> </form> </div> <div id="navigation"> <ul> <li class="selected"><a href="index.php">主页</a></li> <li><a href="" id="new">最新到货</a></li> <li><a href="" id="jacket" onclick="select_jacket()">上装</a></li> <li><a href="" id="xia" >下装</a></li> <li><a href="" id="shoes" >鞋子</a></li> <li><a href="" id="accessories" >配饰</a></li> <li><a href="" id="jewelry" >珠宝</a></li> <div><input type="hidden" id="new1" value="obj_date"></div> </ul> </div> </div> <div class="body"> <div class="featured"> <a href="signup.php"><img src="images/advertisement.jpg" alt=""/></a> <div class="gallery" id="show" > <a href="new_arrival.html"><img src="images/aurora.jpg" alt=""/></a> <ul class="first" > <li><a href="new_arrival.html"><img src="images/summer-collection.jpg" alt=""/></a></li> <li><a href="new_arrival.html"><img src="images/beach-bride.jpg" alt=""/></a></li> <li><a href="new_arrival.html"><img src="images/motherhood-apparel.jpg" alt=""/></a></li> </ul> <ul> <li><a href="new_arrival.html"><img src="images/fashionable.jpg" alt=""/></a></li> <li><a href="new_arrival.html"><img src="images/accessories.jpg" alt=""/></a></li> <li><a href="new_arrival.html"><img src="images/skin-perfect.jpg" alt=""/></a></li> </ul> </div> </div> <div class="article"> <div class="first"> <h3>Please Read</h3> <p>This website template has been collect from <a href="http://www.mycodes.net/" title="源码之家"></a> for you, for free. You can replace all this text with your own text.</p> <p>You can remove any link to our website from this website template, you're free to use this website template without linking back to us.</p> <p>If you're having problems editing this website template, then don't hesitate to ask for help on the Forum.</p> <p>Before using a template from Free Website Templates, you must read all the for further information <a href="#about/terms">Terms of Use</a></p> </div> <div> <h3>Sed Elementum</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vestibulum nibh eget justo dapibus eu porttitor purus hendrerit.</p> <a href="#">www.#</a> <a href="#">www.#/forum</a> </div> <div class="connect"> <h2>Follow us</h2> <a href="#" id="facebook">Facebook</a> <a href="#" id="twitter">Twitter</a> <a href="#" id="comments">Comments</a> <a href="http://www.flickr.com/freewebsitetemplates/" id="flickr">Flickr</a> </div> </div> </div> <div class="footer"> <p>© 2011 Herdesigns. All rights reserved. <a href="http://www.mycodes.net" title="网站模板" target="_blank">欢迎光临</a></p> </div> </body> </html> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" ></script> <script> function search1(){ var keyword= document.getElementById("keyword").value; $.get("obj_search.php",{search:keyword},function(response) { $("#show").html(response); }) } $(document).ready(function(){ $("#new").click(function(){ var order1=document.getElementById("new1").value; $.get("obj_search.php",{order:order1},function(response) { $("#show").html(response); }) }); }); $(document).ready(function(){ $("#jacket").click(function(){ $.get("obj_search.php",{class1:'jacket'},function(response){ $("#show").html(response); }); }); }); $(document).ready(function(){ $("#xia").click(function(){ $.get("obj_search.php",{class1:'xia'},function(response){ $("#show").html(response); }); }); }); $(document).ready(function(){ $("#shoes").click(function(){ $.get("obj_search.php",{class1:'shoes'},function(response){ $("#show").html(response); }); }); }); $(document).ready(function(){ $("#accessories").click(function(){ $.get("obj_search.php",{class1:'accessories'},function(response){ $("#show").html(response); }); }); }); $(document).ready(function(){ $("#jewelry").click(function(){ $.get("obj_search.php",{class1:'jewelry'},function(response){ $("#show").html(response); }); }); }); </script> 除了第一个search1()函数里面的GET 可以正确的执行,下面的全部都不可以,传值传布过去
king4323210 2014-05-21
  • 打赏
  • 举报
回复
JQUERY为加载
t101lian 2014-05-21
  • 打赏
  • 举报
回复
用POST 试下 。 GET没有三个参数吧
码无边 2014-05-21
  • 打赏
  • 举报
回复
jquery路径加载是否正确?
KK3K2005 2014-05-21
  • 打赏
  • 举报
回复
alert($)你先证明下你有jquery
KeepSayingNo 2014-05-21
  • 打赏
  • 举报
回复
你去把juery这个文件下载下来,放在你的系统的目录下,然后像我这样引用

<script language="javascript" type="text/javascript" src="jquery.js"></script>
hlc0110 2014-05-21
  • 打赏
  • 举报
回复
页面上有这个div吗 <div id='news'></div> ,假如有 ,你点击了吗??全部代码贴出来!!!!
king4323210 2014-05-21
  • 打赏
  • 举报
回复
。。。。。jquery本身就是一个闭包的写法。 你在他的命名空间之外,肯定未定义! 坐等接分
花清香茶新味 2014-05-21
  • 打赏
  • 举报
回复
引用 8 楼 zy205817 的回复:
jquery路径加载是否正确?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" ></script> <script> function search1(){ var keyword= document.getElementById("keyword").value; $.get("obj_search.php",{search:keyword},function(response) { $("#show").html(response); }) } $(document).ready(function(){ $("#new").click(function(){ var order1=document.getElementById("new1").value; $.get("obj_search.php",{order:order1},function(response) { $("#show").html(response); }) }); }); 是这样的,前面那个search1()函数里的GET可以执行,但是后面这个就不可以,jquery加载了
  • 打赏
  • 举报
回复
你的jquery路径是否正确,如果正确的话,不会提示$没定义呀
花清香茶新味 2014-05-20
  • 打赏
  • 举报
回复
引用 3 楼 net_lover 的回复:
是不是缓存了啊,你这样啊 .get("obj_search.php?t=" + (new Date()).getTime(),{order:order1},function(response)
还是不行啊
花清香茶新味 2014-05-20
  • 打赏
  • 举报
回复
引用 3 楼 net_lover 的回复:
是不是缓存了啊,你这样啊
.get("obj_search.php?t=" + (new Date()).getTime(),{order:order1},function(response)


加完之后,变成这样了
孟子E章 2014-05-20
  • 打赏
  • 举报
回复
是不是缓存了啊,你这样啊 .get("obj_search.php?t=" + (new Date()).getTime(),{order:order1},function(response)
花清香茶新味 2014-05-20
  • 打赏
  • 举报
回复
引用 1 楼 Return_false 的回复:
你可以利用浏览器的开发者人员工具 监测下请求,看究竟有什么发送请求,或者看下请求状态
没有发送请求,所以说它没有执行这一条或者执行不行
  • 打赏
  • 举报
回复
你可以利用浏览器的开发者人员工具 监测下请求,看究竟有什么发送请求,或者看下请求状态
​ 博主介绍:✌在职Java研发工程师、专注于程序设计、源码分享、技术交流、专注于Java技术领域和毕业设计✌项目名称基于Web的酒店客房管理系统的设计与实现系统说明3.2.1  用户模块功能分析前台模块应主要包括用户登录模块、用户注册模块、查看客房信息模块、客房预定 模块、用户留言模块、充值模块和个人信息维护模块。用户登录模块:用户通过输入注册的的账号和密码,然后进行身份验证,匹配成功 后实现登录功能。用户注册模块:用户输入合法的账号和密码可以实现注册功能。 查看客房信息模块:用户可以通过首页查看客房的价格,图片,详情等信息,从而   可以选择想要预定的房间。 客房预定模块:用户选择自己想要预定的客房后,可以通过输入相关信息进行订房操作。用户留言模块:用户可以向管理员发送留言。 充值模块:用户可以通过添加银行卡再为自己进行充值操作。 个人信息维护模块:用户可以修改自己的姓名、密码、身份证号等信息,还可以查看自己的订单。3.2.2  管理员模块功能分析对于管理员而言,一个好的管理系统总是能让酒店的管理工作事半功倍[7]。管理员 能够通过这个系统对自己的酒店情况一目了然,应该包括客户留言模块、客房管理模 块、订房信息管理模块、入住信息管理模块、统计分析模块、酒店新闻管理模块、会 员信息管理模块、员工信息管理模块、系统用户管理模块、个人信息维护模块。客户留言模块:管理员可以查看并回复用户的留言。客房管理模块:管理员可以管理客房信息,可以添加新的客房,删除已经停用的客房信息,还可以修改现有的客房信息。订房信息管理模块:管理员可以处理用户的订房请求,为用户办理入住手续。入住信息管理模块:对于没有注册的线下客户,也可以办理入住手续。统计分析模块:可以对酒店所有的入住信息进行记录和总结分析。酒店新闻管理模块:管理员可以更新网站上的新闻公告,展示图片等信息。会员信息管理模块:管理员可以查看到所有的注册会员信息,可以对会员信息进行删除,修改,添加操作。员工信息管理模块:管理员可以查看到自己公司所有的员工信息,而且还可以对员工的相关信息进行管理。系统用户管理模块:管理员可以查看到所有的系统管理员信息并对管理员信息进行管理。个人信息维护模块:管理员可以更改自己的登录密码或者是姓名、性别、手机号等 相关个人信息。​编辑 环境需要1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;6.是否Maven项目:否;技术栈1. 后端:Spring+SpringMVC+Mybatis2. 前端:JSP+CSS+JavaScript+jQuery使用说明1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;4. 运行项目,在浏览器中输入http://localhost:8080/ 登录运行截图​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑 用户管理控制层:package com.houserss.controller;import javax.servlet.http.HttpSession;import org.apache.commons.lang3.StringUtils;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import com.houserss.common.Const;import com.houserss.common.Const.Role;import com.houserss.common.ServerResponse;import com.houserss.pojo.User;import com.houserss.service.IUserService;import com.houserss.service.impl.UserServiceImpl;import com.houserss.util.MD5Util;import com.houserss.util.TimeUtils;import com.houserss.vo.DeleteHouseVo;import com.houserss.vo.PageInfoVo;/** * Created by admin */@Controller@RequestMapping(/user/)public class UserController if (ip != null && ip.length() > 0) String[] ips = ip.split(,);for (int i = 0; i  

87,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧