weixin_33725270 2011-02-09 01:01 采纳率: 0%
浏览 30

jQuery Form Ajax调用麻烦

I'm having trouble submitting an ajax request.

I've tried to set it up pretty simply just to see if i can get a response

Here is my js:

$(document).ready(function() {
        $('#mainform').submit(function() {
                $.ajax({
                        type: "POST",
                        url: "processform_ajax.php",
                        data: $(this).serializeArray(),
                        dataType: "json",
                        sucess: function (data) {
                                alert("data" . data);
                                //$("#response").append(data);
                        },
                        error: function(error, txt) {
                                alert(error.status);
                        }
                }); 
       });
});

My php is simply this

<?php
        $errors = array ('a' => 'TEST!');
        echo json_encode($errors);
?>                                                                                                                                                              

When I try to run this with the firebug extension i'm seeing the post looks okay. (which it shouldn't matter at this point, because my php just echo's out something)

On the response side I'm seeing this error : NS_ERROR_NOT_AVAILABLE

Which leads me to believe it can't find processform_ajax.php, but when i've tried the absolute url in url: "" option above. I can also hit the the php script through the browser's address bar and get the json response

Any clues?

Thanks

  • 写回答

2条回答 默认 最新

  • weixin_33716557 2011-02-09 01:13
    关注

    Is sucess a typo in your code, or just on SO?

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮