Getting Re-Directed by Ajax Call

Asked by At

I've got the following Ajax call which sorts a table after clicking on a button. However, I'm finding that when I click on the button the table will sort but after that the site wants to re-direct me to website/?platform=ds&position=&year=2019&status=&match=&s= which just sends me to an error search page on my site.

How can I stop this re-direct call? I've never come across this issue with any of my other Ajax calls.

<script type="text/javascript">
function sortTable(columnName){
 var sort = jQuery("#sort").val();
 jQuery.ajax({
  url:"/wp-admin/admin-ajax.php",
  type:'post',
  data:{
      action: 'call_summary_sortable_update',
      columnName:columnName,
      sort:sort
       },
  success: function(response){
   jQuery("#empTable tr:gt(1)").remove();
   jQuery("#empTable").append(response);
   if(sort == "asc"){
     jQuery("#sort").val("desc");
   }else{
     jQuery("#sort").val("asc");
   }
  }
 });
}
</script>

0 Answers