Hi guys,
I posted a thread about a dynamic form, but my question was probably too big and vague, so I've narrowed it down.
I'll have a dynamic form with lots of checkboxes/radio buttons, to be used for choosing what options you want to buy. When you tick one box, jQuery will query the PHP file, which processes those options have been selected so far. Eg, you tick 'Box 1', and the price of 'Box 2' gets discounted.
So I want to find the cleanest way for PHP to return enough information through jQuery, so that the prices on the user form can all be updated. Does anybody have any suggestions? How would I go about returning a full JS array which I can then use to refresh all of the data?
Thanks!
Robert
jQuery/PHP: Passing lots of PHP data to JS
Moderator: General Moderators
Re: jQuery/PHP: Passing lots of PHP data to JS
JSON.
with json_encode() you can create a native PHP array, encode it as JSON, then have jQuery parse it into a Javascript array.
with json_encode() you can create a native PHP array, encode it as JSON, then have jQuery parse it into a Javascript array.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: jQuery/PHP: Passing lots of PHP data to JS
Thanks a bunch! Looked for a JSON tutorial, and that looks like it'll do the trick.
Cheers.
Cheers.