title: ajax sending 400 bad request error in wordpress
body: <p>Hi everyone i am trying to use ajax in wordpress and got stuck in something. My code is giving me an error in console as </p>
  
  <pre><code>    jquery-3.3.1.js:9600 GET http://localhost/wordpress/wp-admin/admin-ajax.php 400 (Bad Request)
  send @ jquery-3.3.1.js:9600
  ajax @ jquery-3.3.1.js:9206
  (anonymous) @ main.js?ver=1:27
  dispatch @ jquery-3.3.1.js:5183
  elemData.handle @ jquery-3.3.1.js:4991
  </code></pre>
  
  <p>I looked into the source and it is showing me the error on this line</p>
  
  <pre><code>xhr.send( options.hasContent &amp;&amp; options.data || null );
  </code></pre>
  
  <p>This is my jquery</p>
  
  <pre><code>$('#retrieve_users').click(function() {
  
      $.ajax({
              type: "GET",
              url: scriptData.ajaxurl,
              action : 'retrieveUsersData',
              dataType: "html",   //expect html to be returned                
              success: function(response)
              {                    
                  $("#users_data").html(response); 
                  //alert(response);
              }
          });
  });
  </code></pre>
  
  <p>This is my php code in functions.php file</p>
  
  <pre><code>function retrieveUsersData(){
  
  echo "ajax responding";
  }
  
  add_action('wp_ajax_retrieveUsersData','retrieveUsersData');
  add_action('wp_ajax_nopriv_retrieveUsersData', 'retrieveUsersData');
  </code></pre>
  
  <p>and this is my html </p>
  
  <pre><code>&lt;button id="retrieve_users"&gt;Watch Users&lt;/button&gt;
                  &lt;div id="users_data"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Please help!! I didnt know how to import jquery src link in wordpress using wp_enque_scripts so i pasted the  with jquery src directly in html. I hope its not creating problem </p>
  
  <p>Please help.. i would really appreciate it. Thank you</p>