<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
    <form target="_blank" class="form-horizontal" role="form" action='<{$xoops_url}>/modules/neothemesadmin/admin/blockmenusort.php' method='post' >
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><{$smarty.const._MD_UNIT01}></h4>
      </div>
      <div class="modal-body">
      <{$pagrurl.0}>
      <hr />    
      <div class="row">
      <div class="col-md-6"><{$smarty.const._MD_UNIT03}></div>
      <div class="col-md-6">
      <select  class='form-control' name='pagrtype' id='pagrtype'>
      <{$pagrtype}>
      </select><br />
  </div>
  </div>      
  <div id='sortvarbox'></div>        
  </div>
      <div class="modal-footer">
      <input type='hidden' name='url' value='<{$pagrurl.2}>'>     
      <input type='hidden' name='op' value='jointhelink'>  
      <div id='blocktitlebox'></div>
      <button type="button" class="btn btn-default" data-dismiss="modal"><{$smarty.const._MS_SHOPPINGCART77}></button>
      <button type='submit' class="btn btn-primary"><{$smarty.const._MS_SHARED15}></button>
      </div>
      </form>
    </div>
  </div>
</div>



<script type='text/javascript'>
$(document).ready(function() {
  //取得標題數值
   $('#blocktitlebox').html("<input type='hidden' name='blocktitle' value='" + $("#xo-content .block-title a").attr("title") + "'>");
   $("body").on("change", "#pagrtype", function() {
    //取得下選單數值
    ajaxblockpagrtype($selectid = $(this).find(':selected').data('id'));
    function ajaxblockpagrtype($selectid) {
      $.ajax({
        url: '<{$xoops_url}>/modules/neothemesadmin/ajax.php',
        type: 'POST',
        data: {
          id: '2',
          btntype: $selectid
        },
        success: function(response) {
          $('#sortvarbox').html(response);
        },
        error: function() {
          console.log('ajax error!');
        }
      })
    }
  });
});
</script>