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

  • SEARCH
  • Home
  • 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 7974997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:31:48+00:00 2026-06-04T08:31:48+00:00

Here is my code; <script type=text/javascript> function submitform() { $.post(handlers/request.php); } </script> <form action=handlers/request.php

  • 0

Here is my code;

<script type="text/javascript">
function submitform()
{
$.post("handlers/request.php");

}                       
</script>

<form action="handlers/request.php" method="post" data-ajax="false" id="request">
<a href="javascript: submitform()">
<input type="hidden" name="url" value="http://google.com" />
</a>
</form>

In a separate PHP file (handers/request.php) I have a simple:

$url = $_POST['url'];

It isn’t picking this up. Why not?

  • 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-06-04T08:31:50+00:00Added an answer on June 4, 2026 at 8:31 am

    You’re not actually passing any data through.

    $.post("handlers/request.php", { url: $("[name='url']").val() }, function(data){
      console.log( data );
    });
    

    Note the second parameter, it’s an object which will carry our values over to the server-side PHP script. The url key will become $_POST['url'] on the server-end, and will contain our value from the [name='url'] form input.

    Additionally, when binding this functionality to an anchor-click, avoid the following:

    <a href="javascript: submitform()">
    

    Instead, go with something more along the lines of:

    <a class="submit" href="enablejs.html">Submit</a>
    

    Then, within your JavaScript:

    $(function(){
      $("form#request").on("click", "a.submit", function(e){
        e.preventDefault();
        $.post("handlers/request.php", { url: $("[name='url']").val() }, function(data){
          console.log( data );
        });
      });
    });
    

    It’s always good to keep your JavaScript out of your HTML.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to truncate some code here and running into a problem: <script type=text/javascript> $(function()
Here's my code <script type=text/javascript> function getNextScroll(i){ <asp:Literal ID=infiniteScrollTableJS runat=server></asp:Literal> } </script> I am
here is my code.. <script type=text/javascript> function clicker(){ var thediv=document.getElementById('downloadoverlay'); if(thediv.style.display == none){ thediv.style.display
I would like to add this code: <script type=text/javascript src=http://www.formstack.com/forms/js.php?1134414-uqmj2UXxEw-v2> </script> <noscript> <a href=http://www.formstack.com/forms/CampusEnterprises-chopped_greens_order_form__copy
I have the basic jQueryUI progress bar code here; <script> $(function() { $(#progressbar).progressbar({ value:
I use BBC carousel http://www.bbc.co.uk/glow/docs/1.7/furtherinfo/widgets/carousel/ . Here is my script code <script src=/themes/javascript/glow/1.7.7/core/core.js type=text/javascript></script>
I try to us wp_enqueue_script to load my javascript, here is my code: <?php
For example, my goal is to test the code given here: PHP script that
Here is my main page code: <form><iframe name=iframe_pic src=iframe.html></iframe></form> Here is my iframe.html: <script
Here is my javascript code for a cursor focus function to go to username

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.