Is it possible to get the AJAX service response in user control?
-
Hi friends, i am having AJAX call in common.js , like data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete... and getting back the result in the form of JSON in javascipt... As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ? thanks and regards, Dayakar.dn
-
Hi friends, i am having AJAX call in common.js , like data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete... and getting back the result in the form of JSON in javascipt... As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ? thanks and regards, Dayakar.dn
Hi, Please see the below code snippet to use the enums in javascript.
var Days = {"sunday" : 0, "monday" : 1, "tuesday" : 3, "wednesday" : 4, "thursday" : 5, "friday" : 6, "saturday" : 7};
document.write("<b>Day Names Enumerator=</b> " + Days.friday + "<br />");
Output:
Day Names Enumerator= 6Assign the json values to the enum in the javascript. Hope this helps.
-Manognya __________________________________________________ $ God gives what is best.Not what all you wish :)
-
Hi friends, i am having AJAX call in common.js , like data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete... and getting back the result in the form of JSON in javascipt... As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ? thanks and regards, Dayakar.dn
Yes, You make a empty container like a panel control "<div id="container"></div>" on your webform or user control, assign an ID to the container, then the server renders the page and sends the HTML to the users browser. You then write Javascript or JQuery to wait for the DOM to be ready. Now make the call to the web service, parse the JSON response, and use JQuery to populate the container with JQuery written HTML tags, and your JSON data. You just need a container to populate rendered by the server, and on the client side, fill the container, but the DOM has to be ready. While the container is waiting to be populated, and progress indicator can be displayed until the web service is done.