这是我的ajax代码但是当我调用第二个函数时它会抛出错误
jquery.js:9631错误
在这种情况下:
$(document).ready(function() {
$("#set_value").click(function() {
var due = document.getElementById("due_date").value;
var freq = document.getElementById("frequency").value;
if (due != null && freq != null && due != "" && freq != "") {
$.ajax({
type: "POST",
url: "../blocks/mailer/logic.php",
data: {
due_days: due,
frequency: freq,
courseid: '.$COURSE->id.'
}
}).done(function(data) {
alert(data);
location.reload();
});
} else {
alert("Due frequency and Frequency dont be null");
document.getElementById("set_value").focus();
}
});
$("#mod_value").click(function() {
var due = document.getElementById("due_date").value;
var freq = document.getElementById("frequency").value;
if (due != null && freq != null && due != "" && freq != "") {
$.ajax({
type: "POST",
url: "../blocks/mailer/mod/modify.php",
data: {
due_days: due,
frequency: freq,
courseid: '.$COURSE->id.'
}
}).done(function(data) {
alert(data);
location.reload();
});
} else {
alert("Due frequency and Frequency dont be null");
document.getElementById("set_value").focus();
}
});
});