如何使html表单首先提交到X页面等待一段时间并提交到另一个Y页面,因为Y页面需要处理X页面的数据

// How do I make this javascript to submit to y.php first and wait a while until it is processed and submit to x.php

function validatedaily()
{
    form=document.getElementById('myform');
    form.action='y.php';
    form.submit();
    form.action='x.php';
    form.submit();
}

You can try this

 function validatedaily()
{
  form=document.getElementById('myform');
  form.action='y.php';

 if(form.submit()){
    form.action='x.php';
    form.submit();
  }


}

also try using ajax

$.ajax({url: "x.php", async:false, success: function(result){                another(result); }}); function another(result){ $.ajax({url: "y.php",success: function(result){ console.log(result); }}); } 

try with this:

on jQuery

You can use $.ajax() as jQuery.ajax(). Learn about this API here

$.ajax({
    url     :   'x.php',
    type    :   'get',
    dataType:   'json'
    success :   function(xResponse){
        $.ajax({
            url     :   'y.php',
            type    :   'get',
            dataType:   'json'
            success :   function(yResponse){

            }
        });
    }
});

on Angular:

You can use $http.get(), $http.post, $http.put(), etc. Learn about this API here

$http({
    method  :   'GET',
    url     :   'x.php'
}).then(function(xResponse){
    // use xResponse.data to get response data
    $http({
        method  :   'GET',
        url     :   'y.php'
    }).then(function(yResponse){
        // use yResponse.data to get response data
    })
})

"Simple" XHR(pure javascript):

This method work on IE6+ and all Chrome, Chromium, Firefox and Safari versions. Learn about XMLHttpRequest API, MSXML2.XmlHttp.xx API and Microsoft.XmlHttp

var ajax = {};
// prepare xhr api
ajax.x = function () {
    var xhr;
    if (typeof XMLHttpRequest !== 'undefined') return new XMLHttpRequest();
    // API's
    var versions = [
        "MSXML2.XmlHttp.6.0",
        "MSXML2.XmlHttp.5.0",
        "MSXML2.XmlHttp.4.0",
        "MSXML2.XmlHttp.3.0",
        "MSXML2.XmlHttp.2.0",
        "Microsoft.XmlHttp"
    ];
    for (var i = 0; i < versions.length; i++) {
        try {
            xhr = new ActiveXObject(versions[i]);
            break;
        } catch (e) {
        }
    }
    return xhr;
};
// function to send
ajax.send = function (url, callback, method, data, async) {
    if (async === undefined) async = true;
    var xhr = ajax.x();
    xhr.open(method, url, async);
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) callback(xhr.responseText)
    };
    if (method == 'POST') xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    xhr.send(data)
};

// you can use like this
ajax.send('x.php', function(xResponse) {
    // console.log( xResponse );
    ajax.send('y.php', function (yResponse) {
        // console.log( yResponse )
    }, 'GET')
}, 'GET')