从模态形式调用ajax到相同的模态窗口

时间:2012-07-13 20:13:48

标签: php forms jquery

我有以下代码:

jQuery的:

 function suggestPtype() {
    $.ajax({
        type:'POST',
        url: 'include/suggest_ptype_categ.php', 
        data:$('#ptype_form').serialize(), 
        success: function(response) {
           $('#ptype_form').find('.ptype_thanks').html(response);
        }
    });
   return false;
  }

HTML:

<div id="ptype_box" class="ptype_popup">
                <a href="#" class="close"><img src="<?php echo $_SERVER["SITE_HTMLROOT"]?>/images/close.png" class="btn_close" title="Close Window" alt="Close" /></a>
                    <form method="post" id="ptype_form" onsubmit="return suggestPtype();">
                            <span>Product Type</span><input class="required" name="suggest_ptype" value="" type="text" autocomplete="off" placeholder="Product Type"><br />
                            <?php 
                                $namecat=$langid."_name";
                                $result1 = mysql_query ( "SELECT categories.id, categories.$namecat FROM categories LEFT JOIN ptype_new ON ( ptype_new.catid LIKE concat( '%::', categories.id, '::%' ) ) WHERE ptype_new.id =12" ) or die(mysql_error());
                                while($row2 = mysql_fetch_array($result1)){
                                    echo '<input type="checkbox" name="suggest_cat[]" value="'.$row2[0].'"><span id="label" style="padding-left:10px;color:#ffffff; font:13px Arial,Helvetica,sans-serif;">'.$row2[1].'</span><br/>';} ?>
                            <button class="submit button" type="submit" id="doSuggestPtype" name="doSuggestPtype">Save</button>
                            <div class="ptype_thanks"></div>
                    </form>
            </div>

PHP:

    <?php
     if(isset($_POST['doSuggestPtype'])) {
        $suggest_ptype = $_POST['suggest_ptype'];

            echo " Suggested Product Type is:".$suggest_ptype; 
    ?>

class="ptype_popup"是一个模态窗口。 我想通过ajax调用以相同的形式(弹出窗口)调用表单中的值,但我不管理。 我哪里错了

由于 科斯明

0 个答案:

没有答案