How to open a pop up div and pass a query string at the same

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
chauhanRohit
Forum Newbie
Posts: 7
Joined: Thu Feb 20, 2014 11:28 pm

How to open a pop up div and pass a query string at the same

Post by chauhanRohit »

How to open a pop up div and pass a query string at the same time ?

Any one knows how to do this pz reply . i have sucessfully opened a pop up div but,
i cant find any way to pass a query string to the url on the same page.

Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: How to open a pop up div and pass a query string at the

Post by Christopher »

When you say "pass a query string" what do you mean? Are you trying to make a HTTP request while staying on the same page? That can be done with an Ajax all, ore alternatively into an iframe that is displayed...
(#10850)
chauhanRohit
Forum Newbie
Posts: 7
Joined: Thu Feb 20, 2014 11:28 pm

Re: How to open a pop up div and pass a query string at the

Post by chauhanRohit »

yes, thats what i am trying to do, i am new to php and the only way i know is passing a query string than i can use to run a php script
and in this case i cannot add a query string in my <a> tags .
this is what i have done so far

The Html

Code: Select all

<body>
    <p><a href = "javascript:void(0)"  onclick = show('light')>SHOW THE POPUP</a></p>

<!--THIS IS THE POP UP-->    
<div id="light" class="white_content">
  <div id="topdiv">
     <a href ="?page=1" "javascript:void(0)" onclick = hide('light') >
        <span id="closeimage"></span>
     </a>
  </div>
</div>      
<--THIS IS THE MASK-->
   <div id="fade" class="black_overlay"></div>
</body>
The Javascript

Code: Select all

<script type="text/jscript">
        function show(mydiv){
		        var target = document.getElementById(mydiv);
			 $(target,fade).fadeIn(400);
			 }
		   
        function hide(mydiv){
		  	 var target = document.getElementById(mydiv);
			 $(target,fade).fadeOut(400); 
			 }
       $(document).keyup(function(e){
	               if(e.keyCode ==27){
		      $('#light,#fade').fadeOut(400);
		      return false;
		      }
	 });
	 
        $(document).mouseup(function (e)
           {
          var container = $('#light');

          if (!container.is(e.target) // if the target of the click isn't the container...
              && container.has(e.target).length === 0) // ... nor a descendant of the container
           {
           container.hide();
           }
     });
</script>

If i can pass a query string i can check if the variable is set or not and accordingly i can run my php code.

The ajax call and the iframe you are talking about , can you please provide a good link that i can read from ? or a small example will really be helpfull.
Post Reply