function checkA(){
var request = createRequest();
}
function checkB(){
var request = createRequest();
}
You might think you have created two independent request object. In fact, you only create one request object. This might make your system prone to error.
the better way
function checkA(){
var requestForA = createRequest();
}
function checkB(){
var requestForB = createRequest();
}
By removing "var", we can make the request object become a global variable and make sure each request only coping with one ajax request.
No comments:
Post a Comment