这是我的jquery代码:
var category= $('#category').val();
var week = $('#week').val();
var data = {'category': category , 'week': week , 'class': classification , 'pset': pset , 'text_question': question , 'question_keys': keywords};
$.ajax({
url: 'post_question.php', //Server script to process data
type: 'POST',
xhr: function() { // Custom XMLHttpRequest
var myXhr = $.ajaxSettings.xhr();
return myXhr;
},
//Ajax events
success: function(output){
if(output == 'success')
{
alert("success");
}
else
{
alert("failed");
}
},
error: function(){
alert("Error sending question to database!!");
},
// Form data
data: data,
//Options to tell jQuery not to process data or worry about content-type.
cache: false,
contentType: true,
processData: false
});