I’ve updated wordpress to 3.5 and getting this error, j.s not working.
Uncaught TypeError: Cannot call method ‘ajax’ of undefined
Why am I getting this error?
function goToIndexforsave() {
document.getElementById('sorted_successmsg_div').innerHTML = 'processing ...';
var img_save_url = 'http://www.holidayvillas4hire.com/index.php?page=sort_image&pid='+document.getElementById('image_sort').value;
$.ajax({
url: img_save_url ,
type: 'GET',
dataType: 'html',
timeout: 20000,
error: function() {
alert('Error loading agent favorite property.');
},
success: function(html) {
document.getElementById('sorted_successmsg_div').innerHTML = html;
}
});
return false;
}
You need to include
jquery.jsin your page by placing this line within the<head></head>section:You are getting the error because the
$variable which jQuery uses has not been instiated, and therefore the$.ajax()function does not exist.