gpt4 book ai didi

javascript - jQuery 表单插件

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:53:46 24 4
gpt4 key购买 nike

我正在尝试通过 AJAX 上传和提交表单,我发现了 jQuery.form 插件 http://jquery.malsup.com/form/ ,这是我的代码:

     $("#submitSlide").click(function(){

var options = {
success: function(data) {
console.log(data);
},
error : function( jqXHR , textStatus , errorThrown ){
console.log( ' broked ' , jqXHR , textStatus , errorThrown );
} ,
dataType: 'html',
type: 'POST',
url: 'http://www.slideshare.net/api/1/upload_slideshow'
};

$('#ssuploadform').ajaxSubmit(options);


return false;
});

但是我收到这样的错误:

    >>[jquery.form] Server abort: Error: Permission denied to access property 'document' (Error)
>>[jquery.form] cannot access response document: Error: Permission denied to access property 'document'
>>[jquery.form] aborting upload... aborted

你知道如何解决这个问题吗?

谢谢,我感谢任何帮助!

最佳答案

来自 $.ajax()

Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol.

您不能创建跨源 XHR。参见 How do I send a cross-domain POST request via JavaScript?的想法。

关于javascript - jQuery 表单插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6820723/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com