Created
September 24, 2013 14:33
-
-
Save PhilKershaw/6685677 to your computer and use it in GitHub Desktop.
Sample xhr request
This file contains 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
var formData = new FormData(); | |
var str_url = '/ajax'; | |
formData.append('id', int_id); | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', str_url, true); | |
xhr.onload = function(e) { | |
if (this.status == 200) { | |
if (/success/i.test(this.responseText)) { | |
alert('Category Box deleted successfully.'); | |
} else { | |
alert(this.responseText); | |
} | |
} | |
}; | |
xhr.send(formData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment