Skip to content

A minimalist Javascript library to perform AJAX POST and GET Request.

License

Notifications You must be signed in to change notification settings

cbaket/minAjax.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minAjax.js

A minimalist Javascript library to perform AJAX POST, GET and HEAD Request. Forked from https://github.com/cbaket/minAjax.js

#Check Pretty Documentation http://killercode.github.io/minAjax.js/

#Usage Getting Started

<script type="text/javascript" src="https://cdn.rawgit.com/flouthoc/minAjax.js/master/minify/index.min.js"></script>

####Regular

  minAjax({
    url:"test.php",//request URL
    type:"GET",//Request type GET/POST
    //Send Data in form of GET/POST
    data:{
      name:"batman",
      profession:"detective",
      worth:"Rich",
      company:"Wayne Enterprises"
    },
    //CALLBACK FUNCTION with RESPONSE as argument
    success: function(data){
      alert(data);
    }

  });
  

This is example to use minAjax() , these are the frequent arguments which are usually passed for request to take place there are some optional arguments i'll explain them below.

#Compulsory Arguments

#####url:

  url:'Path or Link to Server Side.'

#####type:

  type:'GET or POST'

#Optional Arguments

#####data:

  data:{
          param1:value1,
          param2:value2,
          param3:value3,
          param4:value4,
          //also send Arrays
          foo2:["bar2","bar 3","bar+4"]
          //and blah blah as many param as things support.
          }

#####success:

  success: function(data){
          alert(data);
          //function to be executed on true response with response TEXT as argument.
          }

Execution of Callback function on valid response is totally optional , function can take Response text and Response Status as arguments to process on client side.

#####method:

method:'True For Asyn and False for Non-Async | By default it is True'

By Default Method will be True i.e Async calls . You Can Leave This

#####debugLog:

debugLog:'True to enable Debug Console Logs | By Default it is False'

By Default Method will be False | You Can Leave This

##Example with all arguments

minAjax({
    url:"test.php",//request URL
    type:"GET",//Request type GET/POST
    //Send Data in form of GET/POST
    data:{
      name:"Superman",
      secretname:"Clark Kent",
      profession:"reporter",
      worth:"poor",
      company:"Daily Planet"
    },
    method:"true",
    debugLog:"true",
    //CALLBACK FUNCTION with RESPONSE as argument
    success: function(data){
      alert(data);
    },
    failed: function(data){
      alert("ERROR: " + data);
      }

  });
  

#Fork it , Create Pull @flouthoc (http://twitter.com/flouthoc)

About

A minimalist Javascript library to perform AJAX POST and GET Request.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.2%
  • HTML 48.8%