zoukankan      html  css  js  c++  java
  • ajax取返回值的方法

    转载

    var msg1;
    function Hosts(domain_name, ip_addr, create_person, create_time, host_num, operation) {

    $.ajax({
    async:false,
    type: "post",
    // url: "{{ url_for('sqlmapapi.update_hosts') }}",
    data: "domain_name=" + domain_name + "&ip_addr=" + ip_addr + "&create_person=" + create_person +
    "&create_time=" + create_time + "&host_num=" + host_num + "&operation=" + operation,
    success: function(msg) {
    // window.open('/update/hosts/', _self)
    // alert(msg)
    msg1=msg
    }
    });
    return msg1;
    }

    上面三个地方设置清楚才能取得返回值

    这样就可以调用函数并取得返回值:

    msg = Hosts(domain_name, ip_addr, create_person, create_time, host_num, operation)

  • 相关阅读:
    避免多次提交
    Django 10
    Django 08
    Django 07
    Django 06
    Django 05
    Django 04
    Django 03
    Django 02
    Django 01
  • 原文地址:https://www.cnblogs.com/shengulong/p/7059918.html
Copyright © 2011-2022 走看看