weixin_33725807 2011-06-03 04:21 采纳率: 0%
浏览 22

Ajax Forms返回成功

I'm trying to learn from the http://jquery.malsup.com/form/#getting-started example. When I click submit, the alert of "Thank you for your comment" should pop up, however, it is not working for me. I was wondering if there was something you had to specifically add in comment.php that is being called by the form? Mine is just:

<?php 
echo $_POST['comment']; 
echo $_POST['name']; 
?>

Should there be like a return success or something? How would you implement it? Thanks

  • 写回答

1条回答 默认 最新

  • bug^君 2011-06-03 04:59
    关注

    I just got it to work after I noticed that the page wasn't actually loading any scripts.

    If you copied-and-pasted the example HTML, as I did, try changing the src of the javascript, so that the scripts load and don't return 404s. I.e. instead of jquery-1.3.2.js, insert the full http://jquery.malsup.com/jquery-1.3.2.js.

    <script type="text/javascript" src="http://jquery.malsup.com/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="http://jquery.malsup.com/form/jquery.form.js"></script>
    

    Assuming there's no error, the PHP engine automatically returns a 200 success code in the header:

    HTTP/1.1 200 OK
    
    评论

报告相同问题?

悬赏问题

  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)