dongtuoji5396 2012-08-10 08:11
浏览 35

无法使用jquery将xml数据发布到服务器端(php)

what i am doing is:

  1. reading a xml file with ajax get method

  2. and then updating a particular node value of xml

  3. after updating this xml response i am posting it to the server side (php) for writing that xml file again

i am getting error in posting the updated xml response to server side the error is: NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument

i found this accepted answer but this didn't work for me: How to change the value of an xml node with jquery?

here is my somecode:

$.ajax({
                url: "<?php echo $xmlFilePath;?>",
                type: "GET",
                dataType: "xml",
                success: function(xml){    

                    $(xml).find("Page[id='1']").each(function(){
                       $(this).find('ContentOne').text("New Value");
                    });

                 $.post('<?php echo base_url(); ?>contentadd', { xml: escape($(xml))}, function(data){alert("Data Loaded: " + data);});

                }
        });

any quick response will be helpfull

  • 写回答

1条回答 默认 最新

  • doukanzhuo4297 2012-09-04 07:56
    关注

    Instead of escape I would try to serialize xml with jQuery and unserialize it on server side...

    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀