$.ajax({ url: ajaxurl, type: 'get', data: { action: 'php_function_name', search_term: SEARCH_ME }, success: function(res) { var json = $.parseJSON(res); console.log(json); if (json.status === 0) { response([{ label: "No data found" }]); } else { response(json.data); } } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter