I have got a JQuery as:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function (){
$('#<%=btnUpload.ClientID %>').click(function NewRequest(){
$.ajax({
type: "POST",
url: "../Admin/FileUpload.aspx/<- Hear is [WebMethod, ScriptMethod]->",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function GettingResponse(msg)
{
if(msg = 'Upload Completed SuccessFully')
{
$('#myDiv').text(msg.d);
}
else
{
$('#myDiv').text(msg.d);
NewRequest();
}
}
})
return false;
});
});
</script>
I want to call "GettingResponse" function Recursively,so that on each response from server I can show the client some text and then again Send a Request to server
I don't know whats getting wrong as I dont Know Ajax and Jquery as well.. any other solution to my requirment will also be good...
You can try to call the click
function again when it fails:
$('#<%=btnUpload.ClientID %>').click(function() {
$.ajax({
.....
.....
success: function GettingResponse(msg)
{
if(msg = 'Upload Completed SuccessFully')
{
}
else
{
$('#<%=btnUpload.ClientID %>').click();
}
}
})
return false;
});