douruyun8153 2014-10-10 12:16
浏览 51

JQUERY / AJAX请求不通过和冲突

I have included a contact form in my page. In the same page I have a script that gets prices depending on the value of a dropdown. Now when I try to submit the contact message I have a conflict with the script for prices. Basically it tries to run it and I have no clue why. Also the contact form when submitted never works...I just get a new page to open with URL..?message=blablabla Any idea what is going wrong?

I am working on Laravel 4.2 and so the route you see redirects to my php function. Here is the JSfiddle and here is the php code:

    public function postSendMessage() {
    echo "<span class=\"alert alert-success\" >Your message has been received. Thanks!</span><br><br>";
}
  • 写回答

2条回答 默认 最新

  • duanmo7075 2014-10-10 12:21
    关注

    Cancel the click so the form will not submit

    $("button#send").click( function(evt){
        evt.preventDefault();
    

    New error, form has an id of contact, not a class

    data: $('form.contact').serialize(),
    

    needs to be

     data: $('form#contact').serialize(),
    
    评论

报告相同问题?

悬赏问题

  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan