-2

AJAX をここに配置すると、Firefox では正常に動作しますが、Google Chrome では動作しません。試してみましたが、Google Chrome で動作しません。

<script type="text/javascript">

function action()
{
    jQuery('#dyntable').on('click','.quickview',(function()
    {




        //show all hidden row and remove all showed data
        jQuery(this).parents('table').find('tr').each(function()
        {
            jQuery(this).removeClass('hiderow');
            if(jQuery(this).hasClass('togglerow'))
                jQuery(this).remove();
       });

        var parentRow = jQuery(this).parents('tr');
        var numcols = parentRow.find('td').length + 1;          //get the number of columns in a table. Added 1 for new row to be inserted



        //this will insert a new row next to this element's row parent
        parentRow.after('<tr class="togglerow"><td colspan="'+numcols+'"><div class="toggledata"></div></td></tr>');

        var toggleData = parentRow.next().find('.toggledata');

        parentRow.next().hide();

        var qty =  jQuery(this).val();
        jQuery.ajax({   

              async: false,

              type: 'GET',
               url: "ajax/tabledata.php?id="+jQuery(this).val(),


               success:function(data){
                   toggleData.append(data);

                    parentRow.next().fadeIn();  
                }           
          });

        /*var qty =  jQuery(this).val();            
        var url = "ajax/tabledata.php?id="+qty;

        //get data from server
        jQuery.post(url,function(data){
            toggleData.append(data);                        //inject data read from server
            parentRow.next().fadeIn();                      //show inserted new row
                                                            //hide this row to look like replacing the newly inserted row
        });*/

        return false;
    }));


    //for map view of dropdown

    jQuery('#dyntable').on('click','.showmap',(function()
    {
        //show all hidden row and remove all showed data
        jQuery(this).parents('table').find('tr').each(function()
        {
            jQuery(this).removeClass('hiderow');
            if(jQuery(this).hasClass('togglerow'))
                jQuery(this).remove();
       });

        var parentRow = jQuery(this).parents('tr');
        var numcols = parentRow.find('td').length + 1;          //get the number of columns in a table. Added 1 for new row to be inserted
        var qty =  jQuery(this).val();          
        var url = "Mapdashboard.php?id="+qty;


        //this will insert a new row next to this element's row parent
        parentRow.after('<tr class="togglerow"><td colspan="'+numcols+'"><div class="toggledata"></div></td></tr>');

        var toggleData = parentRow.next().find('.toggledata');

        parentRow.next().hide();

        //get data from server
        jQuery.post(url,function(data){
            toggleData.append(data);                        //inject data read from server
            parentRow.next().fadeIn();                      //show inserted new row
                                                            //hide this row to look like replacing the newly inserted row
        });

        return false;
    })); 


}

</script>
4

1 に答える 1

0

ajax パラメータに dataType も追加してみてください。

dataType: "html"
于 2013-11-11T11:43:43.523 に答える