Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision |
v:0.7.1:advanced:json [2011/11/17 18:36] – external edit 127.0.0.1 | v:0.7.1:advanced:json [2017/04/26 07:02] (current) – external edit 127.0.0.1 |
---|
| |
===== What is JSONP? ===== | ===== What is JSONP? ===== |
''JSONP'' is a magical tool that allows for relatively easy cross-domain javascript calls, which is impossible in most other ways (barring HTML5 functionality). We recommend [[wp>JSON#JSONP|getting a thororugh understanding]], but the basic idea is this: You make a call to an endpoint (your FoxyCart cart) and you get back ''JSON'' //wrapped inside of a function call//. The reason for the function is so that your javascript can actually //do something// with the JSON you retrieve. | ''JSONP'' is a magical tool that allows for relatively easy cross-domain javascript calls, which is impossible in most other ways (barring HTML5 functionality). We recommend [[wp>JSON#JSONP|getting a thorough understanding]], but the basic idea is this: You make a call to an endpoint (your FoxyCart cart) and you get back ''JSON'' //wrapped inside of a function call//. The reason for the function is so that your javascript can actually //do something// with the JSON you retrieve. |
| |
jQuery [[http://api.jquery.com/jQuery.getJSON/|makes this easy]], so let's try a quick example of retrieving the total number of products and the total cart price, less any discounts. | jQuery [[http://api.jquery.com/jQuery.getJSON/|makes this easy]], so let's try a quick example of retrieving the total number of products and the total cart price, less any discounts. |