I know how to write a web-service but until now I used them with always ready scripts. What I want to do this time is, have a web-service will return a string and I want to display this string in a part of webpage. That part may be inside an update panel or not. I know how to use jquery. So my question is how do I call a web-service every 5 seconds and update a part of webpage with the result of web-service. This update should not interrupt any part of the page and never cause post-back.
How can I do that?
asp.net 4.0 , c# 4.0
If your page is already using updatepanels then you could reuse the ms ajax libraries with no need for the jquery library at all.
javascript:
}
}
Page Method in your code behind:
aspx:
change asp:ScriptManager to have EnablePageMethods=”true”
If you’re happy using jquery then just replace the Pagemethods call with an jquery.Ajax call passing in the GetMyStringWebMethod.aspx as the url and handle the string inset in the ajax success event.