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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:02:10+00:00 2026-06-12T08:02:10+00:00

I have a div in which it’s contents are generated by JavaScript. I was

  • 0

I have a div in which it’s contents are generated by JavaScript. I was wondering if it is possible to email the contents of the div? Also is it possible in JavaScript or must it be done in PHP?

  • 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-12T08:02:11+00:00Added an answer on June 12, 2026 at 8:02 am

    You can’t email directly from JavaScript in the browser. You need to send the information to a server side (eg. PHP) file.

    You can do this using a form, but then you need a form field.

    If it’s a div, you should use JavaScript. You can send a request (using AJAX), or, if the information is short and non-sensitive, you can navigate to the PHP page that does the email sending and add the information to the URL string.

    Here is a very quick mock-up of the code. In reality, you should filter inputs and write clean code and whatnot.

    Javascript:

    window.location.href= "http://www.myDomain.com/email.php?data=" + theData ;
    

    where http://www.myDomain.com/email.php is the url of the php file and theData is a variable containing the content of the div.

    PHP

    <?php
      mail("me@myDomain.com", "Content of div", $_GET['data']);  // arguments are: to, subject, body
    ?>
    

    $_GET[‘data’] is the content sent by the JavaScript above.

    I have not included the JavaScript to get the div content into the variable theData

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

Sidebar

Related Questions

I have a div which I update with a count of contents of a
I have a div which works fine <div id=fb-root></div> <fb:like href=<?php echo $link; ?>
I have a div which contains elements using the php include function, and below
I have div which has three buttons as, <div id=buttons> <input id=preview class=ButtonStyle type=submit
I have DIV element which only has a few lines in and a background
I have div class=contentBlock which is treated as the container for updating <div class=contentBlock></div>
I have div ( #child ) which won't expand to the full height of
I have a div which contain lots of input[type=text] fields. I want to put
I have a div which contains 2 elements. First element is a span and
I have a DIV which I want to be removed when I click a

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.