Question

In my application I am able to use pagemethods to call server side functions from the client side. This works no problem. Where I am confused is with the return from the server side function. I am returning a string to the client side (html text) which should be ran and shown when executed.

In the past, we used to use RS.Execute to call these functions and after the call, the returned html would show up on the page. Since we have switched to pagemethods so that the application works in multiple browsers, how can get the returned html to populate in the page in the success function? Thank you for your help.

code example

here is the pagemethod call inside one of my java script functions

PageMethods.LoadChild(lnEntityID, lnEntityCat, GLOBALEQUIPID, FullExpand, 0,0, onSuccess, onFail);

this works, as I am able to trace the server side function and see the function being hit - you shouldn't need more of a code example besides that LoadChild returns a string - which is actually html text. My issue is what needs to be placed in the onSuccess Javascript function so that the returned text from LoadChild can be placed on the page so that the new div and table row (which are what the html returned text represents) show up instantly on the page with our reloading.

Was it helpful?

Solution

Assuming you have on your page:

<div id="myResult"></div>

Then your onSuccess script function is simply:

function onSuccess(args) {
    document.getElementById("myResult").innerHTML = args;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top