Make jQuery Ajax Call

PHOTO EMBED

Wed Sep 06 2023 09:16:54 GMT+0000 (Coordinated Universal Time)

Saved by @mimtiaz #jquery #ajax

$.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);
    }
  }
});
content_copyCOPY