Created
March 21, 2014 22:50
-
-
Save juanpasolano/9698151 to your computer and use it in GitHub Desktop.
Send data from local sails to remote
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-git2.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script> | |
(function(){ | |
function create(data){ | |
$.ajax({ | |
url:'http://192.157.58.90:1337/news', | |
type:'POST', | |
data: data, | |
success: function(data){ | |
console.log('response from server'); | |
console.log(data); | |
} | |
}) | |
} | |
$.ajax({ | |
url: 'http://localhost:1337/news', | |
type: 'GET', | |
success: function(data){ | |
$.each(data, function(k, v){ | |
delete v.id; | |
delete v.createdAt; | |
delete v.updatedAt; | |
create(v); | |
}) | |
} | |
}) | |
})() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment