Home  >  Article  >  Backend Development  >  jquery-php jQuery 实现无刷新验证问题

jquery-php jQuery 实现无刷新验证问题

WBOY
WBOYOriginal
2016-06-02 11:32:31830browse

phpjquery

前台要实现:焦点移出输入框,自动去验证卡券,并把验证结果无刷新返回到提示框中
前台
现在的问题就是,在前台的页面代码

<code>     $(document).ready(function(){       //DOM的onload事件处理函数          $("#button").click(function(){   //当按钮button被点击时的处理函数            postdata();                    //button被点击时执行postdata函数          });       });       function postdata(){            //提交数据函数          $.ajax({                     //调用jquery的ajax方法            type: "POST",              //设置ajax方法提交数据的形式            url: "checkCard.php",             //把数据提交到checkCard.php            data: "codeno="+$("#codeno").val(),  //交的数据            success: function(msg){     //提交成功后的回调,msg变量是checkCard.php输出的内容。              $('check').innerHTML+=msg;            //alert("数据提交成功");    //如果有必要,可以把msg变量的值显示到某个DIV元素中            }          });       } </code>

前台显示区域:

<code>                    <div class="contact-input">                                                 <label>兑换码</label><br>                                                    <input type="text" name="codeno">                        <input type="submit" name="button" id="button" value="WX">                        <div id="check"></div>                                          </div></code>

就是不成功啊,详细可见
http://bbs.csdn.net/topics/391014234?page=1#post-399081723
谢谢大家

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn