﻿//调用范例
/*
定义需要post的参数
var message = {
friendName: $("#txtName").val(),
friendEmail: $("#txtEmail").val()
};
调用方法
submit(message, "body.aspx");
*/
function submit(strData, strUrl) {
    $.ajax().onreadystatechange = handerSuccess;
    $.ajax({
        url: strUrl,
        type: "post",
        data: strData,
        dataType: "text",
        success: handerSuccess,
        error: handerError
    });
    $.ajax().onreadystatechange = handerSuccess;
}
function handerSuccess(xml) {
    if (getState() == 200) {
        if (xml == "True") {
            $("#loading").hide();
            alert("Success");
        }
    }
}
function handerError() {
    alert("哦，页面出错啦，请找下旧金山");
}
function getState() {
    $("#loading").show();
    var strStatus = 0;
    if ($.ajax().readyState == 1) {
        $("#loading").show();
    }
    else if ($.ajax().readyState == 2) {
        $("#loading").show();
    }
    else if ($.ajax().readyState == 3) {
        $("#loading").show();
    }
    else if ($.ajax().readyState == 4) {
        if ($.ajax().status == 200) {
            strStatus = $.ajax().status;
            $("#loading").show();
        }
    }
    return strStatus;
}
function Prompt(xml) {
    var flag = $("flag", xml).text();
    var time = $("time", xml).text();
    alert(flag + time);
}
function Prompt1(xml) {

}
