0
$(document).ready(function() {
    $("#client-list").on("change", function() {
    var selectedValue = $(this).val();
        location.reload();
  });
});

how to refresh only div with id='calender', instead of refreshing complete page, onchange dropdown list option? Complete source i have created a fiddle or how to keep slected option in drop down which was selected and refresh rest of the page?

Suma
  • 11
  • 5
  • try this https://stackoverflow.com/a/21135348/ – Suhail Akhtar Jun 01 '17 at 09:06
  • How? using [AJAX](https://en.wikipedia.org/wiki/Ajax_(programming)) – Mehdi Dehghani Jun 01 '17 at 09:09
  • okay i will check – Suma Jun 01 '17 at 09:10
  • try with jquery [`.load()`](https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0ahUKEwju8bmFp5zUAhULvY8KHWyyBm0QFggxMAI&url=https%3A%2F%2Fapi.jquery.com%2Fload%2F&usg=AFQjCNE6-K3gcBm2gBzipmGsyoj45OGtyg&sig2=dgLWZ3EGWvF40RdQMyJiGQ) – prasanth Jun 01 '17 at 09:12
  • yes @MehdiDehghani – Suma Jun 01 '17 at 12:38
  • I mean the best way that you can solve the problem is `ajax`, if you use `jQuery` in your page, you are in luck, `ajax` is very easy using `jQuery`, as @SuhailAKhtar mentioned, try this https://stackoverflow.com/questions/18490026/refresh-reload-the-content-in-div-using-jquery-ajax – Mehdi Dehghani Jun 03 '17 at 08:15
  • how can i disable drag option if option is not selected in dropdown?( i mean if it still shows as "choose client" in dropdown i dont want user to drag events ) http://jsbin.com/cananidabe/edit?html – Suma Jun 03 '17 at 13:10

2 Answers2

0

You cannot reload only a part of your page unless you use IFRAMES.

Instead, you'll have to use AJAX. Here is a quick example:

<script>
  function refreshCalendar()
  {
     $.ajax({
       type: "GET",
       url: 'http://yourdomain/api/whatever',
       data: "", // You can send some data to the servers
       success: function(data) {
            $('#calendar').html(data);
       }
     });
  }
</script>
user3429660
  • 2,420
  • 4
  • 25
  • 41
  • how can i disable drag option if option is not selected in dropdown?( i mean if it still shows as "choose client" in dropdown i dont want user to drag events ) http://jsbin.com/cananidabe/edit?html – Suma Jun 03 '17 at 13:10
0

You can refresh fullCalender as like this.

Put you calendar code in a function LoadCalendar then call it once on document ready and once on change of dropdown.

function LoadCalendar() {
   $('#calendar').fullCalendar({
      //your options
   });
}
$(function(){
   LoadCalendar();
   $("#client-list").on("change", function() {
      var selectedValue = $(this).val();
      LoadCalendar();
   });
});
Manoj
  • 4,951
  • 2
  • 30
  • 56
  • i don't have any code within my html div, it is generated by drag and drop script, then what i need to mention their? – Suma Jun 01 '17 at 12:37
  • how can i disable drag option if option is not selected in dropdown?( i mean if it still shows as "choose client" in dropdown i dont want user to drag events ) http://jsbin.com/cananidabe/edit?html – Suma Jun 03 '17 at 13:10