Advertisement
Guest User

wordpress ajax call

a guest
Sep 15th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function doAjaxRequest(){
  2.      // here is where the request will happen
  3.      console.log("Started");
  4.      jQuery.ajax({
  5.           type: 'GET',
  6.           url: 'http://nextweb.uc.tdcdev.com/wp-admin/admin-ajax.php',
  7.           data:{
  8.                'action':'do_ajax',
  9.                'fn':'adviser_search',
  10.                'query': 'Valerie'
  11.                },
  12.           dataType: 'JSON',
  13.           success:function(data){
  14.             if(data.success) {
  15.                 console.log(data);
  16.                alert("It works");
  17.              }
  18.            },
  19.           error: function(errorThrown){
  20.                console.log(errorThrown);
  21.                alert('error');
  22.           }
  23.  
  24.  
  25.      });
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement