JSFiddle - React, Tailwind, and code Playground
by baton
HTML
<html><body>
<form action="#">
<button onclick="doGET()" value="Test GET" />
<br/>
<button onclick="doPOST()" value="Test POST" />
</form>
</body></html>
JavaScript
var url = "https://www.googleapis.com/customsearch/v1?key=AIzaSyDrAd-e4NkOe7x9M-zAaTXIEwhkwqMUILo&cx=008002020291309466117%3Ae3jvx1ueckw&lr=lang_es&q=more%3Arecent4+orange&start=1";
function _do( _url, _type ) {
$.ajax( _url, {
xdataType: 'json',
type: _type,
cache: false,
success: function( json ) {
alert( 'success = ' + json );
}
}).error( function( ex ) {
alert( 'error ' + ex );
});
}
function doGET() { _do( url, 'GET' ); }
function doPOST() { _do( url, 'POST' ); }