1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

js post a value and load Website normaly

Discussion in 'Programming' started by vOlLvEriNe, Dec 1, 2015.

  1. #1
    I'm seeking for a solution where I can send a request to a php file to save file from remote server and after this, site should be load normally. Now I'm using jQuery's function post() that send request to file to save a file, that is more than 50MB, after this, user can't access site when file doesn't downloaded properly

    My js code is
    
    $(document).ready(function(){
      $.post("library/DownloadFile.php",{ app:"http://some-site.com/something.mp4", token:"something.mp4"},function(data, status){
    // alert();
    });});
    Code (JavaScript):
    And PHP File is
    
    if($_POST){
      file_put_contents($_POST['token'], file_get_contents($_POST['app']));
    }
    PHP:
    PHP file starting to save file in server, if size of mp4 file is 200MB it takes a long time to save file, so if user open another page of website, he can't access, until PHP file can't save file, so suggest me solution that PHP file download mp4 file dynamically and user can access website properly,

    Sorry for such a long message, I think I can't explain my problem.
     
    vOlLvEriNe, Dec 1, 2015 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #2
    1) What long message :p

    2) What do you mean "load normally" -- you're screwing around with scripttardery (and jQuery bloated crap at that), what are you expecting it to do? I LOOKs like you are doing it with onready, so it's running when the page loads, so what in particular is it NOT doing?!?

    Generally speaking it looks like a double whammy of "what in blazes are you even trying to do".

    Right now it doesn't even look like you are saving anything, you are downloading something via AJAX. Wait, are you trying to have the ajaxtard nonsense act as a page-load? If so, yeah, AJAX doesn't work that way.

    I think it would help if you broke down step by step what you want it to do, from when the user requests the page-load to when whatever you are trying to do finishes.
     
    deathshadow, Dec 1, 2015 IP
  3. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    I mean script start downloading file, like this, in index file, I write a code to put contents, so page will not show anything until whole contents not saved, I make AJAX to to do this, that user can browse website, and file downloading started, but after open web page, user can't browse any page in any website, even file saved
     
    vOlLvEriNe, Dec 2, 2015 IP