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 7192853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:02:24+00:00 2026-05-28T20:02:24+00:00

does anyone know if possible or how to submit a form, use get to

  • 0

does anyone know if possible or how to submit a form, use get to get a posted varable, pass it via ajax to a php function then return the data?

we currently have it on a normal form submit and using smarty to return the data but ive come across the problem with placing this inside a tab so though best to do ajax based to prevent reloading of the page – current working code is as follows:

    {assign var="postocde" value=$smarty.request.postcode}
{assign var="postcode_var" value=$postocde|fn_get_found_locations} 
{assign var="postcode_final" value=$postcode_var}

<div id="postcode_result" {if $postcode_final == '1' || $postcode_final == '2'}class="postcode_result"{/if}>

    {if $postcode_final == '1'}

        {$lang.restricted_shipping_fail}

    {elseif $postcode_final == '2'}

        {$lang.restricted_shipping_success}

    {/if}

</div>

<form method="get" action="{$seo_url.href}" name="restricted_locator" id="restricted_locator" class="cm-ajax">

    <div class="form-field">

    <label for="postcode">{$lang.restricted_shipping_label}:</label>

    <input type="text" value="" name="postcode" size="50" class="input-text cm-hint" id="postcode" />

    </div>

    <input id="submit_postcode" type="submit" value="search" class="moreButton" />

</form>

really appriciate is someone could help or shed some light on this

Cheers!

  • 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-28T20:02:25+00:00Added an answer on May 28, 2026 at 8:02 pm

    Just use the jQuery AJAX call. It will return what ever is echoed out from the php page processing the request. So if you need multiple variables back you can have it echo a JSON string.

    Script on page:

    <script>
    $("#restricted_locator").submit(function(sub){
    
        sub.preventDefault();
    
        $.ajax({
            type: 'POST',  
            url:    '{$seo_url.href}',  
            data:   $('#restricted_locator').serialize(),
            dataType: "json",
            success: function(returned){
    
            // Anything echoed in process-sendform.php will be stored as var "returned"
    
            }
        });
    });
    
    console.log(returned); // will yield the string: "This string will be sent back to page."
    
    </script>
    

    PHP script to send to:

    If you already have a function defined you can just post it in like this. It may be easier to just reformat the function into it’s own page rather than incorporating it into a page.

    <?php
    
    $value1 = $_POST['value1ToFeedToFunction'];
    $value2 = $_POST['value1ToFeedToFunction'];
    $value3 = $_POST['value1ToFeedToFunction'];
    $value4 = $_POST['value1ToFeedToFunction'];
    
    function performFunction($val1,$val2,$val3,$val4){
    
        // do what ever you need to do with passed values here  
        echo "This string will be sent back to page.";
    
    
    }
    
    performFunction($value1,$value2,$value3,$value4);
    
    ?>
    

    EDIT: Regarding your undefined function error

    You must include jQuery in the head of your document:

    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know if its possible to use phing to copy an entire folder
Does anyone know if it's possible to use regex capture within Apache's DirectoryMatch directive?
Does anyone know if it's possible to get a Win32 application to run under
Does anyone know if it's possible to configure CodeCollaborator to submit the changelist when
Does anyone know if its possible to use Bulk insert from following code: FORALL
Does anyone know if its possible to get the Static Maps (image maps) for
Does anyone know is it possible for me to reset/remove the session for php
Does anyone know if its possible to get a list of place recommendations and
does anyone know if its possible to replace the updatepanel in asp.net ajax toolkit
Does anyone know all the possible results for the 3rd value returned from PHP's

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.