Need help modifying javascript (inserting a php value into it)

Incognito2

New Member
Got this javascript that reads data (urls) from a txt file, then puts each url in a frame, calculates how much time it took to load that url in iframe, then display the result into html \[code\]div\[/code\].Here is the code:\[code\]<script type="text/javascript"> $.get("imones.txt", function (data) { var array = data.split(/\r\n|\r|\n/); var beforeLoad = (new Date()).getTime(); var loadTimes = []; var beforeTimes = []; $('#frame_id').on('load', function () { beforeTimes.push(beforeLoad); loadTimes.push((new Date()).getTime()); $('#frame_id').attr('src', array.shift()); try { $.each(loadTimes, function (index, value) { var result = (value - beforeTimes[index]) / 1000; if (result < 0) { result = result * (-1); } $("#loadingtime" + [index]).html(result); beforeLoad = value; }); } catch(ex) {} }).attr('src', array.shift()); });</script>\[/code\]imones.txt has data written in it like so - \[code\]example1.com, example2.com\[/code\] and so on. Instead of reading this \[code\]imones.txt\[/code\] file, i want to replace it with an php array:\[code\]$url_array = array();$url_array[] = 'example1.com';$url_array[] = 'example2.com';\[/code\]And then instead of displaying the result into html div (\[code\]$("#loadingtime" + [index]).html(result);\[/code\]) i want to put that result into another php array:\[code\]$php_array[] = $("#loadingtime" + [index]).html(result);\[/code\]Can someone help me do this?
 
Back
Top