473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Colorbox not appearing on links called through ajax

194 100+
Hi everyone,

I am trying to use colorbox on a page where i have three links each of which have onclick event which call an ajax page and response text is shown in the necessary divs. everything is working fine except colorbox links. After i call the content through ajax the links are not working to appear the colorbox. Here is my code to call the colorbox which is when page is loaded working.
Expand|Select|Wrap|Line Numbers
  1.  
  2. $(document).ready(
  3.  
  4.     function()
  5.     {
  6.     $(".editchecklist").colorbox({width:"50%", height:"35%", iframe:true, onClosed:function(){ location.reload(true); } });        
  7.     }
  8. );
  9.  
I tried to look for this problem but everything is related to jqeury ajax call not simple ajax call. The are advising to use .live() or rebind methods which i have no idea how and where should i use them.
here is my ajax call code:
Expand|Select|Wrap|Line Numbers
  1. function getxmlhttp()
  2. {
  3.     var xmlHttp = false;
  4.     if (window.XMLHttpRequest)
  5.     {
  6.         // If IE7, Mozilla, Safari, etc: Use native object
  7.         var xmlHttp = new XMLHttpRequest();
  8.     }else
  9.     {
  10.         if (window.ActiveXObject)
  11.         {
  12.             // ...otherwise, use the ActiveX control for IE5.x and IE6
  13.             var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  14.         }
  15.     }
  16.     return xmlHttp;
  17. }
  18. function process_ajax2(phpPage, objID, getOrPost,clickedLink)
  19. {
  20.  
  21.     xmlhttp = getxmlhttp();
  22.     var obj = document.getElementById(objID);
  23.     if(getOrPost == "get")
  24.     {        
  25.         xmlhttp.open("GET",phpPage);
  26.         xmlhttp.onreadystatechange = function()
  27.         {        
  28.             if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
  29.             {
  30.                 document.getElementById('change_'+clickedLink).innerHTML = xmlhttp.responseText;
  31.  
  32.             }
  33.         }
  34.         xmlhttp.send(null);
  35.     }
  36. }
  37.  
Please tell me how would i solve this problem?

thanking you.
Dec 10 '10 #1
1 3162
mfaisalwarraich
194 100+
I found solution. just need to add the following code after the response text i.e. after line 30.

Expand|Select|Wrap|Line Numbers
  1. $('a.test').fancybox({
  2.                     'transitionIn'    : 'elastic',
  3.                     'transitionOut'    : 'elastic',
  4.                     'titlePosition'    : 'over',
  5.                     'type'                : 'iframe'
  6.  
  7.     });
  8.  
Dec 10 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gustavo Amigo | last post by:
Hi, iīve started a project on sourceforge. Itīs called Ajax Pages, itīs a scripting template engine that enables rapid development of Ajax Web-based Applications. I would like you guys to take a...
4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
8
by: DartmanX | last post by:
Hi, Looking for recommendations for a decent API for AJAX work. I need it to be somewhat documented so I can figure out how to actually use it. My most critical need right now is clean code...
2
by: GTi | last post by:
I have a ASP 2.0 page where I use some Ajax code. The Ajax code (JavaScript) is inserted from CodeBehind. In my page I have a submit button and some links for Ajax functions. When I load the page...
6
by: Peter Rilling | last post by:
I would like the opinions of those who actually use Ajax libraries and maybe tried various APIs before settling on the one you currently use. I would like to know what libraries (that are free)...
3
by: caston | last post by:
Well, everybody can now agree with the fact that the Ajax hype is over. Still multiple Ajax Frameworks are flourishing, aren't they? So, last night I questioned myself with the following: "When...
10
by: celoftis | last post by:
Using VS 2005: This morning, following the instructions here: http://ajax.asp.net/docs/overview/InstallingASPNETAJAX.aspx, I installed ASP.NET AJAX on my WinXP Pro development machine. Following...
4
by: thehappyappy | last post by:
I have an aspx file that is calling certain xml data depending on the tags. This is then scrolled through the page using Radrotator. I originally had the feed working okay, but have had to change the...
22
by: sheldonlg | last post by:
I am looking for a clean solution to a problem that I solved in, what I call, a "dirty" way. Here is what I want to do. I have a dropdown list. Clicking on an item in the dropdown list invokes...
7
by: Andrew Poulos | last post by:
If I have code that looks like this ajax = function(str) { var val = ""; // do some stuff here return val; }; var foo = ajax("string");
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.