jquery integer post ajax php -> unrecognized expression 0 -
i have following,
var = 0; $('.more').click(function(){ $.ajax({ type:"post", data{"num":i}, url:theurl, success:function(html){ $container.append(html); = i+18;
etc. when post data , in php echo $_post['num']; getting error "syntax error, unrecognized expression: 0" , bunch of html following it. when don't include data number 0 works fine. going wrong here?
if argument append
doesn't begin html tag, it's treated jquery selector. should either wrap in div:
$container.append("<div>" + html + "</div>");
or use .html()
instead of .append()
$container.html(function(i, oldhtml) { return oldhtml + html; });
Comments
Post a Comment