Join two scripts

0

I would like to join these scripts:

<script type="text/javascript">
     $(document).ready(function(){
        $("#value").change(function(){
             var idvalue = $('#value').val();
             $.post("<?php echo base_url(); ?>llamo controlador", {
                 idvalue : idvalue});
         });


        });
</script>

with this other:

<script type="text/javascript">
   $(document).ready(function(){

    $("#contenedorPaginacion").load("<?php echo base_url() ?>llamo controlador");
         $(document).on("click", "#pagination-digg li a", function(e){
          e.preventDefault();          
            var href = $(this).attr("href");
            $("#contenedorPaginacion").load(href);
      });

 });
</script>

Based on the first run the second (I call controller) is the same controller.

    
asked by pescaymar 29.03.2017 в 06:49
source

2 answers

1

Thank you very much, I have little but I like it, thanks] @Maghdiel and @ lois6b, I do not know if it's the right thing to do, but this way it worked for me

$("#value").change(function(){
          var idvalue = $('#value').val();
           $("#contenedorPaginacion").load("<?php echo base_url() ?>llamo controlador",
            {idvalue : idvalue});
       });
       $(document).on("click", "#pagination-digg li a", function(e){
           e.preventDefault();          
           var href = $(this).attr("href");
           $("#contenedorPaginacion").load(href);
      });
    
answered by 29.03.2017 в 09:00
0

If what you want is that, when the first script is loaded, send to call the other function, add it as a function and call the function. Because in itself it seems to me that you should only include everything within 1 only document.ready and put the two as they are.

    
answered by 29.03.2017 в 07:47