第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在ajax中返回多個html數(shù)據(jù)

在ajax中返回多個html數(shù)據(jù)

PHP
犯罪嫌疑人X 2022-12-11 09:25:30
在我的ajax代碼中.....................success: function(datases)                { $.ajax({         url:"checkfitment",         method: 'POST',        data: {checkfitment:checkfitment, make:selectedmakes},        success: function(datas)     { $(".checkfirmentidmsg").html(datas);         }   });  $.ajax({ url:"showattributespecification", method: 'POST', data: {checkfitment:checkfitment , make:selectedmakes}, success: function(datas)         {        $("#specificationsforms").hide();        $("#showattributespecificationmsg").html(datas);              }});} 以上兩個ajax調(diào)用主ajax成功結(jié)果,兩個ajax傳遞相同的數(shù)據(jù)但結(jié)果不同。功能public function checkfitment(){ $make = $_POST['make'];$fiter_products= DB::select(...............);$countfitment = count($fiter_products);if($countfitment > '0')        {?><span class="checkfit"><input type="checkbox" readonly="readonly" checked="checked" name="fitmentchecked" value="1" /> Fits <?php echo $year. ' '.$make.' '.$model;?> <div class="checkfit-oem"><?php echo  '[OEM '.$bolt_pattern.' '.$rim_width.'Jx'.$rim_diameter.']'; ?></div>         <style> .mfp-container{ display:none;}                       .checkFitmentsss{ display:none; position:inherit}                       [type="checkbox"]:not(:checked), [type="checkbox"]:checked {    position: absolute;    opacity:unset  !important;;</style>            <?php}}這次結(jié)果顯示得非常慢,我認(rèn)為它寫在一個函數(shù)和一個 ajax 調(diào)用中,如何將這兩個函數(shù)寫在一個函數(shù)中,如何將這些數(shù)據(jù)存儲在一個變量中?
查看完整描述

1 回答

?
繁花如伊

TA貢獻(xiàn)2012條經(jīng)驗 獲得超12個贊

您能否從服務(wù)器端遵循以下方法并使用以下帶有數(shù)據(jù)類型的ajax方法json來接收多個值


$.ajax({        

    url     : "myurl.php",

    method  : 'POST',

    datatype : 'json',

    data    : {

                params1 : value1,

                params2 : value2

              },

    success : function(datas) {


      $("#elem1").html(data.html1); 

      $("#elem2").html(data.html2);


    }

}); 

myurl.php 服務(wù)器端腳本應(yīng)該如下


<?php

    $return = array();

    $html1  = '';

    $html2  = '';


    $html1.='<h2>This is a test element</h2>';

    $html2.='<h2>This is another test element</h2>'


    $return['html1'] = $html1;

    $return['html2'] = $html2;


    echo json_encode($return); exit;


?>


查看完整回答
反對 回復(fù) 2022-12-11
  • 1 回答
  • 0 關(guān)注
  • 120 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號