Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Javascript Document.ready not working when there is ajax call

$
0
0

Hi All.

I have one script under document.ready function which workes fine when there is  initial page load. i have some controls under update panel which cause partial post back when there is partial post back document.ready not get called

Please help me my code is like this

    $(document).ready(
        function () {
            $('#imgTaxSelect').click(
                function (e) {
                   //TaxValidation();

          var itemflag = true;
var avail = $('#lstTaxAvail').children('option:selected').map(function (i, e) { return e.innerText; }).get();
var selec = $('#lstTaxSelec').children('option').map(function (i, e) { return e.innerText; }).get();
var availval = $('#lstTaxAvail').children('option:selected').map(function (i, e) { return e.value; }).get();
var selecval = $('#lstTaxSelec').children('option').map(function (i, e) { return e.value; }).get();

                       $(availval).each(function () {
                        var taxAvalval = (this.split('|')[1]);


                        $(selecval).each(function (i) {
                        var taxSelecval = (this.split('|')[1]);
                    
                      if ($.trim(taxAvalval) == $.trim(taxSelecval)) {
                      alert('Tax item is already exists for same Tax category for this period ');
                       itemflag = false;
                      }


                    });

                  });
                                       
                    if (itemflag) {
                        $('#lstTaxAvail > option:selected').appendTo('#lstTaxSelec');
                        var output = $('#lstTaxSelec').children('option').map(function (i, e) { return e.value; }).get();
                        var outputtext = $('#lstTaxSelec :selected').text();

                        $("#hdTax").text = outputtext;
                        $("#hdTax").val(output);
                    }
                    e.preventDefault();
                });
 });


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>