dqfr90979 2012-06-15 08:52
浏览 63
已采纳

打开一个jQuery ui对话框,并在表单提交后显示PHP Post响应

I have a jQuery based form which set a value of an hidden input field in a form. I retrieve this value after a form submit with php : $_POST['myinputvar'] (it's a generated url).

This retrieved var is an url to a XML file which I parse with SimpleXML function.

The goal is to display this result in a dialog box after the submission of the form and do my PHP stuff here

The code :

the jQuery to populate my input field :

        $('#myForm').submit(function() {
            $("input[name='field']").val(generatedUrl);
        });

The PHP :

if (isset($_POST['field']))
{
  $xml = simplexml_load_file($_POST['field']);
  print_r($xml);
}

The form :

<form action="http://www.mysite.com/index.php" id="myForm" method="post">
<input name="field" type="hidden" value='' /> 
<input id="submit" type="submit" value="ok" />
</form>

So how can I display my PHP part into a dialog box after submit?

Any help will be very appreciated! Thanks!

  • 写回答

1条回答 默认 最新

  • donglu3087 2012-06-15 09:04
    关注

    Since it seems you don't use AJAX, you can do it that way as statued in the doc :

    <script>
        $(function() {
            $( "#dialog" ).dialog();
        });
    </script>
    
    
    
    <div id="dialog" title="Basic dialog">
        <p><?php echo $xml;?></p>
    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!