Click here to Skip to main content
15,895,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
can anyone tell me How to build a web widget (using jQuery).in my point of view, get data from database through ajax XMLHttpRequset and get responseText in JSON format and display dynamically in webpage with out using document.wrte() method and with passing parameters to js functions. i.e i want to reuse that javascript code in whole project.

please can any one tell me whether this format is right or wrong. and i was unable to get output in this way.

quick help appreciated.
Posted
Updated 16-Feb-12 17:27pm
v7
Comments
BobJanova 16-Feb-12 7:52am    
I removed the C# tag, because this is basically a client side JS question. I assume you know how to get database information on the server side and send HTML in response to an AJAX request already.

Pseudocode, because I don't know how jQuery formats AJAX requests, but broadly:

function updateWidget(url){
 ajaxFramework.sendAjaxRequest(url, function(content){
  myDiv.innerHTML = content;
 });
}


(assuming jQuery lets you make an AJAX request and pass it a callback function)

and, in the HTML
...
<div id=myDiv class=whatever> ... </div>
 
Share this answer
 
you can user $.ajax method of jquery

using thing method you can get json, html data from server side. you can fine more details here $.Ajax Sample Code[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900