Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6359245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:29:35+00:00 2026-05-24T23:29:35+00:00

I have been driving myself crazy to try to do what seems so simple.

  • 0

I have been driving myself crazy to try to do what seems so simple. I have a form where i ask zip code. I am using colorbox to popup a lightbox with an iframe after you input your zipcode. I need to pass the zip code value from the form into the source URL of the iframe. My form code looks like this:

<div class="form-zip-start">
    <p>Enter your zip code to begin your search:</p>
    <form id="submit" action="#" name="submit" method="post">
        <input name="zip" id="zip" type="text" value="" class="zip-start" />               
        <div class="form-submit"><a href="/form.htm" rel="zipformSubmit" class="zipformSubmit">Submit</a></div>
    </form>
</div>

My js code looks like this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="/ppc/colorbox/colorbox/jquery.colorbox.js"></script>
<script>
    $(document).ready(function(){
        $("a[rel=zipformSubmit]").click(function() { $("form#submit").submit(function(e) { 
        var zip = $('#zip').attr('value');  
        colorbox({href: "?zip=" + zip, iframe:true, innerWidth:800, innerHeight:600});
    });
    });
    });
</script>

the end result should be an iframe loaded like…src=”/form.htm?zip=92108″

the 92108 value should be from the form input called ‘zip’

I can’t seem to get the zip code value to pass properly. Can anyhow show me what i’m doing wrong?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:29:36+00:00Added an answer on May 24, 2026 at 11:29 pm

    You need to use preventDefault() to prevent the browser from simply following the link, also you are putting your actions inside the submit event of your form, but you have no submit button, and you are not triggering the submit event, so that event never fires. In this case you don’t need to submit the form, so you can simply make use of the link click event to open the iframe using the data entered in the form. Like so

        <script> 
            $(document).ready(function() { 
            $("a[rel=zipformSubmit]").click(function(e) { 
                e.preventDefault();
                 var zip = $('#zip').val();
    alert("about to open colorbox with zipcopde " + zip);
                $.colorbox({href: "?zip=" + zip, iframe:true, innerWidth:800, innerHeight:600}); 
            }); 
            });  </script> 
    

    Note: some validation would be good if (zip.length > 0) { } etc

    Added after Comment:

    IN order to bring in your $_GET['Source'] you should add a hidden form field:

        <div class="form-zip-start">
            <p>Enter your zip code to begin your search:</p>
            <form id="submit" action="#" name="submit" method="post">
    <input type='hidden' name='source' id='source' value='<?php echo $_GET['Source']; ?>' />
                <input name="zip" id="zip" type="text" value="" class="zip-start" />               
                <div class="form-submit"><a href="/form.htm" rel="zipformSubmit" class="zipformSubmit">Submit</a></div>
            </form>
        </div>
    

    then make the js:

    <script> 
                $(document).ready(function() { 
                $("a[rel=zipformSubmit]").click(function(e) { 
                    e.preventDefault();
                     var zip = $('#zip').val();
                     var source = $('#source').val();
        alert("about to open colorbox with zipcopde " + zip);
                    $.colorbox({href: "?source="+source+"&zip=" + zip, iframe:true, innerWidth:800, innerHeight:600}); 
                }); 
                });  </script> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This had been driving me crazy.... I have an iPhone app that is using
I have a problem that has been driving me batty. I have code that
This has been driving me crazy for the past few minutes I have a
This has been driving me crazy. I think I have everything in place but
I've been driving myself crazy over the past few days over this one. We've
This has been driving me crazy for 2 days. I have been trying to
I have an AutoMapper issue that has been driving me crazy for way too
This has been driving me crazy for the past couple of hours. I have
I have been trying to figure out driving directions using user input and it
This has been driving me crazy for a few days now. I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.