I wrote a script using jQuery and AJAX today, and I get some errors...
The script:
function changeAdmin(id) {
$(document).ready(function() {
$(\'#ta
Try code below, but if you receive an error like "Unexpected token <", you need to check your php file - "ajax_utf.php" and check what is returned in browser (Chrome) View->Developer->Developer Tools, Network tab -> XHR.
$.ajax({
type: 'post',
url: postLink,
dataType: 'json',
data: postData,
beforeSend: function (x) {
if (x && x.overrideMimeType) {
x.overrideMimeType('application/json;charset=UTF-8' );
}
},
success: function (result) {
//console.log(result);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(arguments);
}
});