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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:25:07+00:00 2026-06-01T00:25:07+00:00

I have a wordpress site for ex, www.test.com There is a js file (forms.js)in

  • 0

I have a wordpress site

for ex, http://www.test.com

There is a js file (forms.js)in the script folder of mytheme folder.

ie (theme/mytheme/script/forms.js)

There is a mail.php page in mytheme folder

ie (theme/mytheme/mail.php)

Following is the content of forms.js

function submitFormToEmail()
{

    var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        //document.getElementById("results").innerHTML=xmlhttp.responseText;
        alert("Form received, thank you!");
        }
      }
        xmlhttp.open("GET","/mail.php",true);
    xmlhttp.send();

}

I will call “submitFormToEmail”,if we click a image in the page *www.test.com/hello_test*

Where “hello_test” page lies in theme/mytheme/.

But the mail.php is not working.

Let me know ,how can we set the path of mail.php in the function “submitFormToEmail”, so that it will work

  • 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-01T00:25:08+00:00Added an answer on June 1, 2026 at 12:25 am

    Calling /mail.php will look for the mail.php file at http://www.test.com/mail.php. Just fix the path?

    Either directly code the correct path into the javascript file or use php to dynamically get it using get_bloginfo. There are several ways to do this, but probably the best way is to create a hidden element on the page that contains the url and then fetch this when building your ajax request. Otherwise you’d have to set php to parse js files and include it in there. Doesn’t seem like a good way to me though.

    get_bloginfo('template_url');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Wordpress site (www.nurseresumetips.com) and I'm using a theme named JVPress. This
I have installed wordpress on my site located at www.example.com/blog . on www.example.com I'd
I have a wordpress site at http://myname.myprovider.info and I just bought the domain http://www.myname.com
I have a WordPress site and the following link is accessible: www.domain.com/wp-admin/ (obviously not
I have a simple RSS feed coming in my Wordpress site with php, but
I have a asp.net site www.example.com on a Microsoft server. I also have a
I have a wordpress site that I moved from domain.info to domain.com. Some of
I have my wordpress in a sub-folder on my domain with a .htacess file
I just installed WordPress in a subfolder on my site (http://www.example.com/wordpress/) and I want
At the moment, I have a wordpress-based site at http://sub.mydomain.com , running for 2

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.