我在cfm页面中有一个ajax调用来更新mysql db,数据将被插入数据库然后停止而没有错误。如果我删除插入查询页面,它将返回成功。
JAVASCRIPT
$.ajax({
type: "POST",
url: url,
data: dataString,
crossDomain: true,
cache: false,
beforeSend: function(){
$("#addEvent").html('Connecting...');
},
success: function(data){
if (data=="success") {
window.location.href = "events.html";
} else if(data=="failed") {
navigator.notification.alert('Failed to add event.');
$("#addEvent").html('addEvent');
}
}
});
的ColdFusion
<cfif formType eq "addEvent">
<cfquery name="addEventQuery" datasource="#mysql_db#" username="#mysql_username#" password="#mysql_password#">
INSERT INTO events (event_admin) VALUES ('1')
</cfquery>
<cfoutput>success</cfoutput>
</cfif>