var send = {ff_ID:"",ff_k:""};
send.ff_ID = $(this).attr("id");
send.ff_k = $(this).find("span").text();
$.ajax({
type: "POST",
url: "/funfact_ajax",
cache:true,
dataType:"json",
data:send,
success: function(data){
if(data.success == true){
$(this).text(eval(send.ff_k)+1);
}else{
alert(data.msg);
}
}
});
problem is this line "$(this).text(eval(send.ff_k)+1);"
if i use it outside ajax , it's no problem at all ..
$(this).text("damn");
have the same error ..
here is error :
[Error] TypeError: undefined is not an object (evaluating 'a.createDocumentFragment') db (jquery-1.11.1.min.js, line 3) buildFragment (jquery-1.11.1.min.js, line 3) domManip (jquery-1.11.1.min.js, line 3) append (jquery-1.11.1.min.js, line 3) (anonymous function) (jquery-1.11.1.min.js, line 3) access (jquery-1.11.1.min.js, line 3) text (jquery-1.11.1.min.js, line 3) success (funfact, line 192) j (jquery-1.11.1.min.js, line 2) fireWith (jquery-1.11.1.min.js, line 2) x (jquery-1.11.1.min.js, line 4) b (jquery-1.11.1.min.js, line 4)
i have no clue what is the problem , need help , thx !
send
in that code supposed to be …? – CBroe Aug 15 '14 at 4:13