Page 1 of 1

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

Posted: Mon Jul 14, 2014 5:30 am
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

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

Posted: Tue Jul 15, 2014 8:06 pm
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...

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

Posted: Wed Jul 16, 2014 1:54 am
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.