javascript - Retrieving JSON from PHP File, and Append inside div -
Is trying to pass the real-time graph update within my site i basically a php in every 30 seconds Trying to reload the file, to deselect it, I've dynamically unpacked the data of PHP as json code as shown below. The ad also contains Actually now I want to put some jquery code on my index.php page to load this file, explain json code and add data to the correct divs. Example: I am looking at jquery.com and basically taking the above mentioned Jason data, and on the stack overflow for ways to add it. This is a bit about creating a PHP file: and
& lt; div class = "yesterdayEPC" & gt; 0.03 & lt; / Div & gt;
$ ("Dashboard-stats.php", function (data) {$ ("body") .append ("Kleppy:" + data. If EPC) // John.Append ("Time:" + Data yesterday EPC); / / 2pm}, "json");
$ month_visits = mysql_num_rows (Mysql_query ("SELECT * FROM locker_portport
WHERE uid
= '$ user_id' and month
= '$ month_date' ")); $ Month_clicks = mysql_num_rows ("Select FROM report
WHERE uid
= '$ user_id' and month
= '$ month_date' and Status
= '1' ")); $ Month_leads = mysql_num_rows ("Select FROM report
WHERE uid
= '$ user_id' and month
= '$ month_date' and Status
= '2' ")); If ($ month_head == "" $ month_click == "") {echo json_encode (array ("month calculateCR" => n / a ")); Echo json_encode (array ("monthpc" = & gt; "n / a")); } And {$ monthCalculateCR = number_format ($ month_clicks / $ month_leads) "%"; Echo json_encode (array ("monthcimalcr" => gt; $ monthCalculateCR. "" "))); $ Month EPC = number-format ($ month_heads / $ month_clicks, 2). ""; Echo json_encode (Array ("month CRC" = "" Month "); $ month EPC." "" ");} If ($ month visits ==" ") {echo (" month CRR "= > "N / A");} and {$ month CTR = number-format ($ month_click / $ month_ visit, 2) * 100 "%"; echo json_encode (array ("month CRR" => "Code" setTimeout To call the function
$ .get () the jQuery method to remember the PHP method that eats JSON.
reload ( ); Repeat the function $ ('$ MyDiv'); $ (.get) {$ .get ("yourFile.php", function (data) {// updated data data by json.data = $ .parseJSON} .append );}); SetTimeout (reload, 30000);}
Comments
Post a Comment