根:Create.php
根/资源/ JS:ajaxLibrary.js
在我create.php文件我有一个看起来像这样的形式:
Create
我ajaxLibrary.js看起来是这样的:
function submit_basic(event) {
//var formData = new FormData($(this)[0]);
//event.preventDefault();
$.ajax({
url: 'resource/php/submit_basic.php',
type: 'POST',
data: 'hello',
async: false,
success: function(response) {
alert("Profile Successfully Created!");
show_profile_sideMenu();
},
cache: false,
contentType: false,
processData: false
});
return false;
}
如果我运行此代码Ajax的工作原理和提醒消息,但页面重新加载。如果我使用preventDefault()函数,那么ajax甚至不会运行。如果我取消注释使用FormData对象的第一行,则ajax不会发出警报,但会重新加载页面。这里有什么问题?谁能解释一下?提前致谢。
+0
show this show_profile_sideMenu();函数 –
+0
你有什么show_profile_sideMenu();功能。尝试调试此功能。 –
+0
函数show_profile_sideMenu(){ \t $('#sidemenu_details')。addClass('cbp-spmenu-open'); \t $('#profile_basic')。removeClass('active in'); \t $('#profile_details')。addClass('active in'); } –