duannaoye0732 2016-10-26 06:14 采纳率: 100%
浏览 55
已采纳

无法加载页面

I want to pass value from my first form to another but when i pass only single value it opens the page but when i try to pass more than one value it doesn't open the page.

With only one value, it works finely.

<script type="text/javascript">
$(document).ready(function() {
$("#div1").load("http://ppp.qwert.com/wp-content/themes/thestory/compare-form-site.php?loanamt=" + <?php echo $_POST['loanAmt']; ?>); 
});             
</script>

With more than,one it fails to load the page. I am getting error only for character value which i am capturing. like any element with character value not defined. How do i solve this error.

$("#div1").load("http://ppp.qwert.com/wp-content/themes/thestory/compare-form-site.php?loanamt="+<?php echo $_POST['loanAmt'];?>+"&occupation="+<?php echo $_POST['occupation']; ?>+"&rateType="+<?php echo $_POST['rateType']; ?>+"&age="+<?php echo $_POST['age']; ?>+"&city="+<?php echo $_POST['city']; ?> );

here is my html code

<div id="dynamicform" class="dynamicform">
  <div class="formDiv" id="offeringTypeIdDiv_31">
    <form name="offeringTypeIdForm_31" id="offeringTypeIdForm_31" action="http://ppp.qwerty.com/16708-2?q=gold+loan" method="post" >
      <input type="hidden" name="offeringTypeId" value="31">
      <input type="hidden" name="q" value="gold+loan">   
      <div class="fStep1" id="fStep1">
          <input type="hidden" value="15" name="product_id"/>
        <h3>Compare Gold Loan Offers</h3>
        <div class="form-main">
          <label class="formLabel">Purpose</label>
          <select id="purpose" class="inputwraprer" tabindex="0" style="width: 100%; height: 39px;">
            <option value="">Purpose</option>
            <option value="Gold Loan" selected="selected">Gold Loan</option>
          </select>
        </div>
        <div class="form-main">
          <label class="formLabel">Loan Amount</label>
          <input type="text" name="loanAmt" id="loanAmt" value="" class="inputwraprer" required tabindex="1" autocomplete="off" placeholder="Enter Loan Amount" />
        </div>
      </div>
      <div style="clear:both;"></div>
      <div class="fStep2" id="fStep2">
        <div class="form-main">
          <label class="formLabel">Occupation</label>
          <select name="occupation" class="inputwraprer" required tabindex="2" style="width: 100%; height: 39px;">
            <option value="">Occupation</option>
            <option value="Salaried"
                            >Salaried</option>
            <option value="self+Employed"
                            >Self Employed</option>
          </select>
        </div>
        <div style="clear:both"></div>
        <div class="form-main">
          <label class="formLabel">Interest Type</label>
          <span class="putradio">
          <input class="radioButton required" type="radio" id="fixed" value="Fixed" name="rateType" tabindex="3" />
          Fixed</span> <span class="putradio">
          <input class="radioButton" type="radio" id="floating" value="Floating" name="rateType" tabindex="4" />
          Floating</span> <span class="putradio">
          <input class="radioButton" type="radio" id="both" value="Both" name="rateType" tabindex="5" />
          Both</span> </div>
        <div style="clear:both"></div>
        <div class="form-main">
          <label class="formLabel">Age</label>
          <select id="age" class="inputwraprer" required tabindex="6" name="age" style="width: 100%; height: 39px;">
            <option value="">Age</option>
            <option value="18"
                            >18 Years</option>
            <option value="19"
                            >19 Years</option>
            <option value="20"
                            >20 Years</option>
            <option value="21"
                            >21 Years</option>
            <option value="22"
                            >22 Years</option>
            <option value="23"
                            >23 Years</option>
            <option value="24"
                            >24 Years</option>
            <option value="25"
                            >25 Years</option>
          </select>
        </div>
        <div style="clear:both"></div>
        <div class="form-main" id="cityDiv">
          <label id="cityLabel" class="formLabel">City</label>
          <input type="hidden" id="cityTextBox" name="cityTextBox" />
          <select id="city" name="city" class="inputwraprer" placeholder="Enter a city" style="width: 100%; height: 39px;" required tabindex="7">
            <option value="" selected="selected">Select a city</option>
            <option value="9">Bangalore</option>
            <option value="20">Chennai</option>
            <option value="27">Faridabad</option>
            <option value="28">Ghaziabad</option>
            <option value="32">Gurgaon</option>
            <option value="36">Howrah</option>
            <option value="38">Hyderabad</option>
            <option value="49">Kolkata</option>
            <option value="57">Mumbai</option>
          </select>
        </div>
      </div>
      <div style="clear:both"></div>
      <div class=" form-main" style="text-align: center;margin: 10px 0 15px;">
        <input type="submit" name="submitForm" value="Compare" class="submitButton" id="submitForm">
      </div>
    </form>
  </div>
</div>
  • 写回答

2条回答 默认 最新

  • donglong7338 2016-10-26 06:21
    关注

    You forgot the closing double quote " at the end also the doubles for the concatation is not needed you must directly echo your php.

    You only use concat if you are using javascript variables

    change from

     $("#div1").load("http://ppp.qwert.com/wp-content/themes/thestory/compare-form-site.php?loanamt="+<?php echo $_POST['loanAmt'];?>+"&occupation="+<?php echo $_POST['occupation']; ?>+"&rateType="+<?php echo $_POST['rateType']; ?>+"&age="+<?php echo $_POST['age']; ?>+"&city="+<?php echo $_POST['city']; ?> );
    

    to

     $("#div1").load("http://ppp.qwert.com/wp-content/themes/thestory/compare-form-site.php?loanamt=<?php echo $_POST['loanAmt'];?>&occupation=<?php echo $_POST['occupation']; ?>&rateType=<?php echo $_POST['rateType']; ?>&age=<?php echo $_POST['age']; ?>&city=<?php echo $_POST['city']; ?>" );
    

    in this way you are just like doing this

     $("#div1").load("http://ppp.qwert.com/wp-content/themes/thestory/compare-form-site.php?loanamt=value&occupation=value&rateType=value&age=value&city=value" );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 在不同的执行界面调用同一个页面
  • ¥20 基于51单片机的数字频率计
  • ¥50 M3T长焦相机如何标定以及正射影像拼接问题
  • ¥15 keepalived的虚拟VIP地址 ping -s 发包测试,只能通过1472字节以下的数据包(相关搜索:静态路由)
  • ¥20 关于#stm32#的问题:STM32串口发送问题,偶校验(even),发送5A 41 FB 20.烧录程序后发现串口助手读到的是5A 41 7B A0
  • ¥15 C++map释放不掉
  • ¥15 Mabatis查询数据
  • ¥15 想知道lingo目标函数中求和公式上标是变量情况如何求解
  • ¥15 关于E22-400T22S的LORA模块的通信问题
  • ¥15 求用二阶有源低通滤波将3khz方波转为正弦波的电路