Created
December 5, 2015 08:43
-
-
Save anttti/56cf2ce025b0321e66d4 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
| $(function() { | |
| $("#axios").on("click", function() { | |
| axios.post("http://wordpress.dev/wp-json/wp/v2/movie", { | |
| title: $("#title").val(), | |
| status: "publish" | |
| }, { | |
| headers: { | |
| "Authorization": "Basic YWRtaW46YWRtaW4=" | |
| } | |
| }).then(function(res) { | |
| console.log(res); | |
| }).catch(function(err) { | |
| console.log(err); | |
| }); | |
| }); | |
| $("#jquery").on("click", function() { | |
| $.ajax("http://wordpress.dev/wp-json/wp/v2/movie", { | |
| method: "post", | |
| headers: { | |
| "Authorization": "Basic YWRtaW46YWRtaW4=" | |
| }, | |
| data: { | |
| title: $("#title").val(), | |
| status: "publish" | |
| } | |
| }).done(function(res) { | |
| console.log(res); | |
| }).fail(function(err) { | |
| console.log(err); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment