title: Making ajax call a repetative function so i can call it again n again
body: <p>how can i make a J query ajax function so whenever i needed it i just passed a parameter to it instead of writing whole code again and again for example
  here is an ajax code  </p>
  
  <pre><code>&lt;script&gt;
      $(function () {
          $.ajax({
              url: "ajax/select.php",
              dataType: "json",
              success: function (data) {
                  $.each(data, function (index) {
                      $("#names").append("&lt;li&gt;"+data[index].name+"&lt;/li&gt;")
                  });
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>now if i wanted to make another ajax request with to a page i have to write these line of code with different URL data and message how can i make it in a function so u just push parameter to it and it works form me 
  like </p>
  
  <pre><code>&lt;script&gt;
      function multiple_calls(url, datatype, success) {
          $.ajax({
              url: url,
              dataType: datatype,
              success: success
          });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and called it anywhere i wanted to its just a demo but can someone suggest me how can i do it ? and please avoid negative marking as i m about to block please its a humble request </p>