php jquery ajax不工作在chrome和ie但在Mozila firefox工作正常

时间:2014-07-29 06:18:06

标签: javascript php jquery ajax

你好朋友我有一个ajax调用更新p标签html。我在firefox和opera中工作正常,但不能在chrome中工作,即

function updatepart() {
     var count = jQuery('.abc').length;
     var bbb = count - 1;
     var partno = $("#partno-"+bbb+"").val();
     var ptname = $("#ptname-"+bbb+"").val();
     var brandname = $("#brandname-"+bbb+"").val();
     var modelname = $("#modelname-"+bbb+"").val();
     $.ajax({
    type: "POST",
    url: "http://computerdada.com/get_updatepart.php",
    data: "partno="+ partno +"&id="+ bbb +"&custname="+ ptname +"&brandn="+ brandname +"&modeln="+ modelname,
    cache: false,
    success: function(data)
    {
    $('#'+bbb).html(data);
    $("#partdetails-"+bbb ).focus();
    }
    });

   }

我的php代码是

<div id="main">
  <span id="track1" class="abc">
  <p id="0">
  <input type="text" name="ptname[]" id="ptname-0" class="ptname" value="" placeholder="Party Name" /><input type="text" name="brandname[]" id="brandname-0" class="brandname" value=""  placeholder="Brand Name" /><input type="text" name="modelname[]" id="modelname-0" class="modelname" value=""  placeholder="Model" /><input type="text" name="partno[]" id="partno-0" class="partno" value=""   placeholder="Part Number" onchange="return updatepart();"/><input type="text" name="partdetails[]" id="partdetails-0" class="partdetails" value=""   placeholder="Configration"/><input type="text" name="qty[]" id="qty-0" value="" size="4"  placeholder="Qty" onchange="return updateprice();" /><input type="text" name="pricein[]" id="pricein-0" class="pricein" value=""  placeholder="Price In" /><input type="text" name="priceout[]" id="priceout-0" class="priceout" value=""  placeholder="Price Out" onchange="return track();"/>
  <input type="checkbox" name="status[]" id="status-0" value="confirm" size="4" /></p></span>
 </div>

它调用partno文本框的onchange属性。

要检查它,请访问http://computerdada.com/parts.php它的代码在firefox和chrome中工作正常但在ie和chrome中没有工作 请帮帮我

1 个答案:

答案 0 :(得分:0)

我遇到了这个问题。尝试使用.change jQuery函数 http://api.jquery.com/change/

$(document).ready(function(){


    $('input').change(function(){    
        // Your code
    });

});