0

I want to include two jquery library in same page.function name 'myfunction' is common for both selectbox and datepicker.datepicker function call uses .onload the page I called loaddata() function for pagination.It uses .So I want to know how to include both the library in same page.

Now I'm using 1.4.3 library so onload and .rec select box works but not datepicker function.

    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/start/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 

The above library is for calling function via datepicker

  $rec="select * from recruiter where comp_id='$comp'";
               $rec1=mysql_query($rec);

               echo '<select class="rec" id="r" name="e_first_name" style="width:155px;" required onchange="myFunction(this.value);">';
               echo '<option value="" selected>Select Recruiter</option>';
               while($rfet=mysql_fetch_assoc($rec1))
               {
                 echo '<option value="'.$rfet["e_id"].'">'.$rfet["e_first_name"].'</option>';
               }
               echo '</select>';


              echo ' <input type="text" name="dob" style="width:155px;display:none;"  id="datepicker1" placeholder="Choose Date" onchange=myFunction("'.$rfet["e_id"].'"); size=18 maxlength=50>';
               echo '<select name="report" style="width:155px;" class="report" onchange=myFunction("'.$rfet["e_id"].'");>
               <option selected> Select Filter</option>
               <option value="datz">By Date</option>
               <option value="week">By week</option>
               <option value="month">By month</option>
               </select>';
 echo ' <input type="text" name="dob" style="width:155px;display:none;"  id="datepicker1" placeholder="Choose Date" onchange=myFunction("'.$rfet["e_id"].'"); size=18 maxlength=50>';
  function myFunction(e_id)
{  

  $("#pre").hide();

   var fdat= $("#datepicker1").val();
   var filt= $(".report").val();
   var c=$("#r").val();

  $.ajax({
        type: "POST",
        url: "query3.php",
        data: { action: c,filt: filt,fdat: fdat},
        error: function(msg) {

        },
        success: function(text) {

            $(".refresh").html(text);          
        }
    });

   }
user3386779
  • 6,883
  • 20
  • 66
  • 134

1 Answers1

1

As per your comment you need to use jQuery.noConflict.

In below example, two version of jquery included

  1. jquery-1.10.3.min.js
  2. jquery-1.11.3.min.js

For jquery-1.10.3.min.js - $ will be the alias ie. you will access using $. But after jquery-1.11.3.min.js and I mean just after we have included jquery. noConflict(true) that means now we have resolve the conflict and defined a custom alias as $j. Now you can access jquery-1.11.3.min.jswith $j alias. Hope this clears.

For example,

<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.3.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
  <script type="text/javascript"> 
        $j = jQuery.noConflict(true); 

        $j(document).ready(function(e){     
            $j("#test").click(function(){
                 alert("hi");
            });             

        });

 </script> 

</head>
<body>
<button id="test" type="button">Say Hi</button>
</body>
</html>
Akki619
  • 2,386
  • 6
  • 26
  • 56
  • I used with $j = jQuery.noConflict(true); but var fdat= $("#datepicker1").val(); var filt= $(".report").val(); var c=$("#r").val(); are not passed to next page in .report select tag and datepicker – user3386779 Aug 31 '15 at 07:32
  • First, if you want to access 1.10.2 jquery then u need to use $j instead of $. Second, I see you are using protocol less url?Are you running app on server or local. If local I would suggest use http or https as required to load jquery. If this doesn't solve then you need to debug your code more – Akki619 Aug 31 '15 at 07:37
  • how you are passing this to next page? That's another query. I can't see that in you code block. – Akki619 Aug 31 '15 at 07:40
  • ya I want to pass value fetched using jquery to next page. on my second page this value is not passed,If use 1.4.3.js along with this – user3386779 Aug 31 '15 at 07:41