簡體   English   中英

在PHP和JQuery之間傳遞DOMDocument

[英]Passing DOMDocument between PHP and JQuery

問題是在PHP和JQuery之間傳遞對象。

在JQuery中執行$.post ,我想檢索在'get_domdoc.php'中生成的DOMDocument對象,然后能夠$.post回到其他PHP文件,例如:

    $.post("get_domdoc.php", {url: url}, function( domdoc )
    {

    //prepare 'domdoc' to $.post it - in a usable format - to another PHP file

    });

這可能嗎? 感謝任何幫助。

最直接的方法可能是將其轉換為發送PHP腳本中的字符串,將其視為jQuery中的字符串數據,並在接收PHP腳本中創建新的DOMDocument

理論上你可以serialize() DOMDocument對象,但這感覺很糟糕(如果可能的話)。 交換正確的XML看起來像去IMO的方式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM