Posts

Showing posts from February, 2012

Why String is immutable or final in Java

Differences between String, StringBuffer and StringBuilder in Java

Key Differences between Vector and ArrayList in Java

Submitting form using Fancybox Ajax capabilities within an iFrame

there is two way:

1:

$("a.interested").fancybox({'width':400,'height':400,'enableEscapeButton':false,'overlayShow':true,'overlayOpacity':0,'hideOnOverlayClick':false,'type':'iframe','href':"/components/profile/buyer/regbuyer1.php"//or any other url that contains the contents of that iframe});2:$("a.interested").click(function(){     $.ajax:{         type     :"POST",         cache    :false,         url      :"/components/profile/buyer/regbuyer1.php",         success:function(data){             $.fancybox({'width':400,'height':400,'enableEscapeButton':false,'overlayShow':true,'overlayOpacity':0,'hideOnOverlayClick':false,'content': data             });}}});

How to fetch only data value using ajax

To fetch data from ajax response follow this......

$.ajax({
          url: your_url,
          success: function(req){
            var data = new Array();
            var pairs = req.split("&");
            for (i = 0; (i < pairs.length); i++) {
              var nameAndValue = pairs[i].split("=");
              var name = unescape(nameAndValue[0]);
              var value = unescape(nameAndValue[1]);
              data[name] = value;

            }
            $("#startDate").val(data['startDate']);
            $("#endDate").val(data['endDate']);
            $("#comments").val(data['comment']);
            $("#year").val(data['currentSession']);
          }
        });

set name value pair in your response in action class separated by any char. I just do with '&'
and u can fetch data by name. No need to set whole div. You  just set value in your desired field and location.

eg:--  name1=valu…

jquery code to detect ctrl+F1 key

jQuery(document).keydown(function(event){
      if(event.keyCode==17)
          {
          jQuery(document).one("keyup",function(e){
          if(e.keyCode==112)
              $("#addSession").click();
          });
          }
  });