I am using jquery.ajax() to search a db table and return the data to a div on my page.
When clicking the search link the script fails at returning the usrObj to the div, and throws the msg Uncaught Error: NOT_FOUND_ERR: DOM Exception 8.
I was told this can be caused by a syntactical error? But I’m not seeing the problem…
Here is my code:
$(function() {
//hide default articles
$("ul a").click(function(event){
$(".short_article").addClass("hidden");
});
$('#search-box').submit(function() {
$.ajax({
type: 'POST',
url: 'faq/search.php?',
data: 'Term=body',
success: function(jqXHR){
var usrObj = $.parseJSON(jqXHR);
$('#load_window').html (usrObj);
alert ("Search failed"); //no alert displays
}
});
return false;
});
});
<div id="load_window"></div>
Get rid of the space after “html”:
…should be