在下面的代码,我想改变的代码读取行:
如何使我的jQuery代码识别参数的URL,然后选择一个代码行
$("#commentload"+ID).prepend(html);
因此,如果在URL中找到参数order=1
,例如,http://my.com?order=1
然后它应该执行。
$("#commentload"+ID).append(html);
而不是
$("#commentload"+ID).prepend(html);
希望你明白我的意思。
$(document).ready(function(){
// Update Status
$(".update_button").click(function(){
var updateval = $("#update").val();
var dataString = 'update='+ updateval;
if(updateval==''){
alert("Please Enter Some Text");
} else {
$("#flash").show();
$("#flash").fadeIn(400).html('Loading Update...');
$.ajax({
type: "POST",
url: "message_ajax.php?CID=" + CID + "&Id="+Id,
data: dataString,
cache: false,
success: function(html){
$("#flash").fadeOut('slow');
$("#commentload"+ID).prepend(html);
$("#update").val('');
$("#update").focus();
$("#stexpand").oembed(updateval);
}
});
}
return false;
});
//commment Submit
});
我已经为你格式化了你的文章。请记住缩进代码四个空格来格式化它。造型通常会识别它是哪种语言。如果不是这样,你可以用'<! - language:lang-etc - >'作为前缀,''''是'''','''''''''''''''''''''css'样式表“或类似的。 – Daedalus
谢谢代达罗斯!我对这种造型仍然很陌生。你那时溺爱我,但我会从中吸取教训。非常感谢。 –