Jquery – How to load values into an HTML form with jQuery

ajaxformsjqueryload

I'm trying to create an ajax form with jQuery. I'd like to load existing values into the different form fields (text boxes, dropdown menus). Would I use JSON for this? And how would I load the values? Iterate through the JSON and for each entry load the corresponding value? How would this be done?

Thanks in advance.

Best Answer

Is there a reason that your are not loading them in from your server side code?

The overhead of converting into JSON and then loading into the form using JavaScript/jQuery would be much greater that simply populating them with server-side script code. Not to mention adding the requirement that any browser must have Javascript turned on to view your page.