zoukankan      html  css  js  c++  java
  • AJAX

    $.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(); } 
        } 
    
  • 相关阅读:
    网络规划和布线
    网络编程
    NoSQL 非关系数据库
    OpenCV
    首页
    C++关键字
    TCP/IP 详解7 Ping指令
    TCP详解 (1)
    GRE封装解封装过程
    GRE tunnel
  • 原文地址:https://www.cnblogs.com/ddyq/p/2026299.html
Copyright © 2011-2022 走看看