开发者

Dynamic XML Generated from PHP

I have a PHP script that loads XML content dynamically:

require_once 'directory/directory/';  
$nice= '1149632';  

$key = 'adf995jdfdfddda44rfg';   
$mixer  = new Live_Products($key);  

$result = $mixer->product($nice)  
->show(array('name','Price'))  
->query();

echo $result

This will work fine when it is loaded. But I am trying to use an ajax/jquery script to send the value $nice to the PHP script; and to ultimately send the result back from the dynamically created XML file. I've been trying to figure this out for hours

Here is the ajax Script

function sendValues() {  
$("$nice")  
    $.ajax({  
        url: "/myphp.php",  
        data: {str}  
        cache: 开发者_Python百科false  
    });  
}  

Has anybody done something similar to this concept?


Why not pass it as a GET param like so...

jQuery

function sendValues(something) {  
    $.ajax({  
        url: "/myphp.php?nice=" + something,  
        cache: false,
        dataType: 'xml',
        success: function(xml) {
            // Work with the XML
        }  
    });  
} 

PHP

require_once 'directory/directory/';  
$nice= '1149632';  

$key = 'adf995jdfdfddda44rfg';   
$mixer  = new Live_Products($key);  

$result = $mixer->product($_GET['nice'])  
->show(array('name','Price'))  
->query();

// You said it is XML?
header('Content-Type: text/xml');

echo $result;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜