Tuesday, May 21, 2024
 Popular · Latest · Hot · Upcoming
155
rated 0 times [  157] [ 2]  / answers: 1 / hits: 16172  / 8 Years ago, tue, september 6, 2016, 12:00:00

I am getting this error message at the console for line:



var dataString = 'search='+ searchid;


at following script:



$(function(){
$(.search).keyup(function() {
var searchid = $(this).val();
var dataString = 'search='+ searchid;
if(searchid!='') {
$.ajax({
type: POST,
url: classes/search.php,
data: dataString,
cache: false,
success: function(html) {
$(#result).html(html).show();
}
});
}
return false;
});
});


What is wrong there?


More From » javascript

 Answers
50

There is no need to escape quotes in this situation:



var dataString = 'search=' + searchid;


And as commented the next line also has issue. Remove the slashes.


[#60799] Saturday, September 3, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaleyv

Total Points: 259
Total Questions: 99
Total Answers: 107

Location: Saint Helena
Member since Tue, Nov 3, 2020
4 Years ago
;