user2129623
user2129623

Reputation: 2257

Post php variable to multiple other files at same moment

Below code post myid variable to url.php.

$.ajax({
url:'url.php' //'url.php,test.php' is invalid
,async: true
,type : 'POST'
,cache: false
,data : 'myid=' + myid
,dataType: 'html'
,success: function(data){
$('body').html(data);
FB.XFBML.parse();
}
}

How can I post it to multiple other files at same moment? I need myid in various files also.

Upvotes: 0

Views: 79

Answers (2)

user2895892
user2895892

Reputation:

function send(_url) {
    $.ajax({
        url: _url
        ,async: true
        ,type : 'POST'
        ,cache: false
        ,data : 'myid=' + myid
        ,dataType: 'html'
        ,success: function(data){
            $('body').html(data);
            FB.XFBML.parse();
        }
    }
}

['url.php','test.php'].forEach(send);

Upvotes: 1

Lucky Soni
Lucky Soni

Reputation: 6878

Maybe in your url.php make a curl POST request to other PHP files as needed

Upvotes: 0

Related Questions