HTML code:
jquery code:
$(document).ready(function(){
$("#repTable span.address").each(function(){
var spanTemp = $(this);
$ .ajax({
type: "get",
url: "SceneryAjaxCall.aspx",
data: "sid=" $(this).attr("id"),
cache: true,
dataType: "html",
success: function(msg){
spanTemp.append(msg);
}
});
});
});
When writing jquery code, I encountered the following problems:
(1) I did not write the third line at the beginning, but at the beginning. In line 11, $(this) is directly called, and the error "Cannot assign a value to the callback function" is reported. The reason is that the object has changed after the callback, so it needs to be saved in advance;
(2) The dataType is not written, and msg cannot be returned. I don’t know why;
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn