私は次のJavaScriptを持っています:
var User;
(function (User) {
(function (AccessControls) {
User.AccessControls.loginFormSubmit();
function loginFormSubmit() {
$('#article').on('submit', '#loginForm form', function () {
var $form = $(this);
if(!$form.valid()) {
return false;
}
var myData = $form.serialize();
var myUrl = $form.attr("action");
return false;
});
}
AccessControls.loginFormSubmit = loginFormSubmit;
})(User.AccessControls || (User.AccessControls = {}));
var AccessControls = User.AccessControls;
})(User || (User = {}));
//@ sourceMappingURL=loginFormSubmit.js.map
私が得る正確なエラーは次のとおりです。
Uncaught TypeError: Object #<Object> has no method 'loginFormSubmit'
なぜ私がこのエラーを受け取るのか誰かが説明できますか?
それが役立つ場合は、これが私のタイプスクリプトコードです:
module User {
export module AccessControls {
loginFormSubmit();
export function loginFormSubmit() {
$('#article').on('submit', '#loginForm form', function () {
var $form = $(this);
// if there are validation errors do not continue.
if (!$form.valid()) {
return false;
}
// get the form data
var myData = $form.serialize();
// get the url to post to from the form's action attribute.
var myUrl = $form.attr("action");
// execute the post
//$.ajax({
// url: myUrl,
// data: myData
//success: function(data) {
// // on success, write the returned article content into the article element
// $('#article').html(data);
//}
return false;
});
}
}
}