PDA

View Full Version : This is strange



Tonata
12 Oct 2010, 03:13 PM
Hi all, I am coding an application that conducts student tests and exams online. I save the answers to the database individuallly, so for each question and answer I have a Save button. When this button is clicked, the system connects to the DB with ajax and saves the answer. The problem I have now is this works in Firefox but not in Internet explorer, can anybody please explain to me why. Below is my code

My function


function updateAnswer(questionNum) {

var answer = $('#answer_'+questionNum+':checked').val();
if (answer==undefined){
answer = $('#answer_'+questionNum+'').val();
}
var questionNumber = $('#questionNumber_'+questionNum+'').val();
var test = $('#testId').val();
var student = $('#student').val();

$.ajax({
type: "POST",
url: "ajax.updateAnswer.php?student="+student+"&questionNumber="+questionNumber+"&answer="+answer+"&test="+test,
success: function(result){
if (result == 'KO') {
alert('Question could not be updated');
} else {
$('#update_'+questionNum+'').removeAttr('disabled', 'disabled');
}
}
});

};

Update answer is called onclick of the Update button, in the function I pass the id of the question as parameter.