My question : Can an infinite loop of ajax call can create problem ?
Given there is a code like :
ajaxcall();
function ajaxcall(){
jQuery.ajax({
type: "POST",
url: myurl,
data: mydata,
cache: false,
success: function(data){
if (something )
{
ajaxcall();
}
},
error: function(){},
complete: function(){}
});
}
As you can see, in executing the ajaxcall, if the something is true, it will execute again the ajaxcall().
In case where, the something condition is everytime true, can it cause some problems in navigator or server or something else ? And in case of 'yes there will be big problem', what are the ways to protect against this ?
Thanks for your attention...
UPDATE AFTER ANSWER
I ask this because in inspecting my WordPress Login page, i was wondering was will happened :
If someone with bad intention, open a navigator inspector to find the name of inputs inside form to generate data [in this case 'log' and 'pwd'], and use this kind of code to find a login [, and after a password] with use of navigator's console.
In making a condition on the returned data.
sendCheckFormAnswer();
function sendCheckFormAnswer(){
jQuery.ajax({
type: "POST",
url: myLoginPostUrl,
data: {log:generatedLogin,pwd:generatedPassword},
cache: false,
success: function(data){
if (data.indexOf(badLoginMessage)>=0)
{
codeTogenerateANewLogin();
sendCheckFormAnswer();
} else {
alert(generatedLogin);
}
},
error: function(){},
complete: function(){}
});
}
In Addition , here is my login form page :
<form name="loginform" id="loginform" action="http://www.###########.fr/wp-login.php" method="post">
<p>
<label for="user_login">Identifiant<br>
<input type="text" name="log" id="user_login" class="input" value="" size="20"></label>
</p>
<p>
<label for="user_pass">Mot de passe<br>
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20"></label>
</p>
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever"> Se souvenir de moi</label></p>
<p class="submit">
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Se connecter">
<input type="hidden" name="redirect_to" value="http://www.saint-pierre-de-curtille.fr/wp-admin/">
<input type="hidden" name="testcookie" value="1">
</p>
</form>
A bad login and bad password return bad login message. A good login and bad password return a bad password message.