Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It only raises the bar to hacking very slightly, but you <em>can</em> POST JSON via <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow"><code>jQuery.ajax</code></a> (that's a link) or <a href="http://api.jquery.com/jQuery.post/" rel="nofollow"><code>jQuery.post</code></a> (so's that). <code>jQuery.getJSON</code> is just a wrapper for <code>ajax</code> (as are <code>.post</code>, and <code>.get</code>). From the <a href="http://api.jquery.com/jQuery.getJSON/" rel="nofollow"><code>getJSON</code> docs</a>:</p> <blockquote> <p>This is a shorthand Ajax function, which is equivalent to:<pre>$.ajax({ url: url, dataType: 'json', data: data, success: callback });</pre></p> </blockquote> <p>Thus, to do your <code>postJSON</code> concept, you'd just add a <code>type</code> parameter to it:</p> <pre><code>$.ajax({ url: url, type: 'POST', // &lt;== the new bit dataType: 'json', data: data, success: callback }); </code></pre> <p>If you really wanted to, you could add a <code>postJSON</code> to the <code>jQuery</code> object, pre-processing the arguments and then calling <code>$.ajax</code>. This is basically a copy-and-paste from <a href="https://github.com/jquery/jquery/blob/master/src/ajax.js" rel="nofollow">the jQuery source</a>, but switching <code>.get</code> to <code>.post</code>:</p> <pre><code>if (!jQuery.postJSON) { jQuery.postJSON = function( url, data, callback ) { return jQuery.post(url, data, callback, "json"); }; } </code></pre> <p>Mind you, it's still pretty easy to fake a POST. Not as easy as a GET, but still pretty easy.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload