Created
October 8, 2013 01:46
-
-
Save Tim-Machine/6878131 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setMessage = function(selector , message){ | |
| $(selector).html("");//clear html | |
| $(selector).html(message);// insert message | |
| } | |
| makerequest = function(url , data , callback, type){ | |
| $.ajax({ | |
| url: url, | |
| data: data, | |
| type: type | |
| }).done(function(somedata) { | |
| // is call back a function? | |
| if (callback && typeof(callback) === "function") { | |
| callback(data); //send to callback funtion | |
| }else | |
| return data; | |
| }); | |
| } | |
| myfunction = function(){ | |
| $data = makerequest('www.com', {name:'ted',name:'test'} , null , 'POST'); | |
| setMessage('#message1', $data[0]); | |
| } | |
| myfuction() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment