admin管理员组文章数量:1327750
I have the following code:
$.ajax({
url: modal.href,
dataType: 'json',
type: 'POST',
data: modal.$form.serializeArray()
})
.done(onSubmitDone)
.fail(onSubmitFail);
TypeScript points to the $.ajax and gives a message saying:
Supplied parameters do not match any signature of call target.
However from what I can see my $.ajax is correct and I am correctly referencing the jQuery definitions. Can anyone suggest what might be wrong?
I have the following code:
$.ajax({
url: modal.href,
dataType: 'json',
type: 'POST',
data: modal.$form.serializeArray()
})
.done(onSubmitDone)
.fail(onSubmitFail);
TypeScript points to the $.ajax and gives a message saying:
Supplied parameters do not match any signature of call target.
However from what I can see my $.ajax is correct and I am correctly referencing the jQuery definitions. Can anyone suggest what might be wrong?
Share Improve this question edited Oct 29, 2012 at 8:44 Fenton 251k73 gold badges401 silver badges409 bronze badges asked Oct 29, 2012 at 8:06 user1679941user16799412 Answers
Reset to default 4Referring to jquery.d.ts:
ajax(url: string, settings: JQueryAjaxSettings);
This is the signature of ajax function. You should move the url out of the settings object and pass in as a parameter instead for typescript to accept. Or edit the jquery.d.ts definitions to accept settings only function call.
While the initial jQuery definitions do not contain the overload without the Url, they have been updated and you can take the latest version from CodePlex: http://typescript.codeplex./SourceControl/BrowseLatest
There is also a mirror of the latest updated jQuery definitions at https://github./borisyankov/DefinitelyTyped
本文标签: javascriptajax call not recognized by TypeScriptStack Overflow
版权声明:本文标题:javascript - $.ajax call not recognized by TypeScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742233697a2437686.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论