开发者

I need to display XML in jquery parsed from a PHP file

Here is the Parser in PHP it currently displays in PHP and I need a function to display the parsed images in jQuery.

开发者_运维百科
for($y = 0; $y <= 1; $y++){
    $featured_channel = array_values($featured_channel);
    $arraytotal = (count($featured_channel)-1);
    $x = rand(0,$arraytotal);

I want to pull $featured_channel[$x]-> into jQuery and display the images in that.


Have the PHP file output whatever information you want to display on your page and then use an ajax call to grab that information from the PHP file into a javascript function:

----JavaScript----

function get_data() {
    $.get('path_to_script.php', function (data) {
        $('#some_container_element').html(data);
    });
}

NOTE: this function expects the PHP file to have formatted the output to be directly added to the webpage, something like:

----PHP Output----

>>Title Here<<
<img src="http://website.com/image.jpg" />
<br>
>>Description Here<<
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜