Uwak Peter

Uwak Peter

  • 1.3k
  • 86
  • 5.5k

How to call multiple c# methods on pageload using webmethod

Feb 14 2014 11:04 AM
i want to load some c# methods using ajax/json web method, please help check whether these code fractions are correct
 
 
function getMoreNewsItems(url) {
$.ajax({
type: "POST",
url: url,
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg.d);
}
});
}
getMoreNewsItems('<%= ResolveUrl("headlinenews/loadFeedBellaNaija") %>')
getMoreNewsItems('<%= ResolveUrl("headlinenews/loadFeedChannelsTV") %>')
getMoreNewsItems('<%= ResolveUrl("headlinenews/loadFeedNaijaLoaded") %>')
[WebMethod]
private static void loadFeedBellaNaija()
{
}
[WebMethod]
private static void loadFeedChannelsTV()
{
}
[WebMethod]
private static void loadFeedNaijaLoaded()
{
}
i am using VS 2010 with the new routing functionality, Please is this code correct? if yes,
how can i call getMoreNewsItems on page load. Thanks in advance...