$.ajax({ type: "get", url: strURL, dataType: "txt", error: function () {
alert('Error');
}, success: function (data) {
var _msg = "收藏成功"; if ("-1" == data) {
_msg = "请登录以后收藏";
} else if ("0" == data) { _msg = "收藏失败"; } else {
$("#inp_sc").get(0).onclick =
""; $("#inp_sc").click(function () { alert('已收藏'); });
} alert(_msg);
}
});
function toPost(url, params) {
alert(url); createXMLHttpRequest(); xmlHttp.open("POST",
url, true); xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function () { ShowResult(); }; xmlHttp.send(params);
} //回调方法
function ShowResult() {
if (xmlHttp.readyState == 1 || xmlHttp.readyState
== 2 || xmlHttp.readyState == 3) { } else if (xmlHttp.readyState == 4) {
if (xmlHttp.responseText
== "f") { alert("图片生成失败"); } else {
document.getElementById("d_out").innerHTML =
"<img src='" + xmlHttp.responseText + "' />";
}
}
} var xmlHttp; function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); }
}