-
-
Save xjamundx/3902535 to your computer and use it in GitHub Desktop.
validator.nu client-side
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
// easy way to get current pages HTML | |
$.get('#', function(html) { | |
// emulate form post | |
var formData = new FormData(); | |
formData.append('out', 'json'); | |
formData.append('content', html); | |
// make ajax call | |
$.ajax({ | |
url: "http://html5.validator.nu/", | |
data: formData, | |
dataType: "json", | |
type: "POST", | |
processData: false, | |
contentType: false, | |
success: function(data) { | |
console.log(data.messages); // data.messages is an array | |
}, | |
error: function() { | |
console.warn(arguments); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment