Hi,
I created an ajax request, request1, in prototype+cakePhp function getItemDetailsCheckItemAvailability, and inside that request1 I created another ajax request, request2 (function submitIsbn).
It stopped working on the 2nd attempt of invoking ajax request1. Is creating an ajax request inside another ajax request allowed by the specifications?
function submitIsbn(formId, actionurl, idToUpdate){
var myform = $(formId);
myform.action = actionurl;
var returnval = myform.request({
onCreate: function(request, xhr){
displayWorkingSign("loadingAnimationDivId")
},
onComplete: function(request, json){
removeWorkingSign("loadingAnimationDivId");
$(idToUpdate).innerHTML = returnval.transport.responseText;
}
});
}
function getItemDetailsCheckItemAvailability(formId, actionurl, actionurl2,idToUpdate, idToUpdate2) {
if ($('RecomIsbn') != null && $('RecomIsbn').value == '') {
alert('Please enter the ISBN');
}
else {
var myform = $(formId);
var originalAction = myform.action;
myform.action = actionurl;
var returnval = myform.request({
onCreate: function(request, xhr){
displayWorkingSign("loadingAnimationDivId")
},
onComplete: function(request, json){
removeWorkingSign("loadingAnimationDivId");
$(idToUpdate).innerHTML = returnval.transport.responseText;
// submitIsbn will check whether the item is in the Library Catalogue or not
submitIsbn(formId, actionurl2, idToUpdate2);
}
});
}
}