views:

64

answers:

1

I need to open an iframe (Frame 1) and from frame1 i need to open frame2 using jquery colorbox.

I have used the following script from a page to open frame1:

function ViewUser(Id) {
       $.colorbox({ href: '/user/View/' + Id + '?popup=1', iframe: true, width: "100%", height: "100%", title: 'View User', overlayClose: false, escKey: false, onLoad: function() { $('#cboxClose').hide() }, onComplete: function() { $('#cboxClose').show() } });
}

I have added the following script from frame1 to open frame2, but its not opening the page (just opens a blank colorbox).

function UpdateUser(Id) {     
  parent.$.colorbox.close();
  parent.$.colorbox({ href: '/User/Update/' + Id + '?popup=1', iframe: true, width: "100%", height: "100%", title: 'Update User', overlayClose: false, escKey: false, onLoad: function() { $('#cboxClose').hide() }, onComplete: function() { $('#cboxClose').show() } });
}

Am i missing anything here?

A: 

Try this: Modified updateUser as:

function UpdateUser(Id) {
  $.fn.colorbox({
    href: '/User/Update/' + Id + '?popup=1', 
    iframe: true, 
    width: "100%", 
    height: "100%", 
    title: 'Update User', overlayClose: false, 
    escKey: false, 
    onLoad: function() { 
      $('#cboxClose').hide() 
    }, 
    onComplete: function() { 
      $('#cboxClose').show() 
    }
  });
}

Same way modified $.colorbox to $.fn.colorbox inside ViewUser().
No need to colobox close and all stuff.

Mayur bhalgama