This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 7 years ago.
I am making a simple website, but to save I am making it send some text to an email using javascript.
I want to make it send directly, but if there is no way to do that it would be fine if it sends by going to the email site.
My code so far looks like this:
var a = function(){
var b = document.getElementById("email").value;
document.getElementById("textarea").value.mailto=b;
};
I want the code to send the value of the textarea.
You should have a server somewhere which listens to email sending commands. Your Javascript should send an AJAX request to that server, passing the necessary data and triggering the email sending functionality. The server, in turn should send the email(s) and respond to the Javascript part to notify the client-side whether it was successful.
Related
This question already has answers here:
Can I perform a DNS lookup (hostname to IP address) using client-side Javascript?
(16 answers)
Closed 4 years ago.
I need to check whether my email address has valid host, exist for example someone#yahoo.com might return valid meanwhile some#yahozzz.com might return invalid (because invalid host)
I stumbled upon a code in git for golang that satisfy my needs for that https://github.com/badoux/checkmail, but currently at the moment i'm looking for the solution in javascipt, any help will be appreciated.
P.S. : I am using this code as a script inside my HTML
Actually to verify that an email exists and is active you have to send a message to the email server and check the response.
That cannot be done entirely in javascript although you can rely on a service instead than on your backend like this
This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 4 years ago.
I have a problem. I want to put a contact form on the page, but I do not know how to do it in the Vue. I wanted to do it normally as jquery, php, but it does not work in Vue. Does anyone have an idea what I can do?
Vue is a View (hence the name) library, meant for describing your View layer i.e. how your application looks. Such logic as sending an email would for one be dependent on Javascript itself and not on Vue.
However it is not possible to send an email from Javascript in the browser. Instead you'd need to build a backend which can send an email for you, or you could call the user's email client, both described here.
You would ideally send email data (to, message body - html escaped of course) as a request to a backend end point and send from there. You can use Vue's HTTP resource to send the request: https://github.com/pagekit/vue-resource
But sending an email directly from Vue isn't possible.
This question already has answers here:
What is the difference between client-side and server-side programming?
(3 answers)
Closed 8 years ago.
I'm writing a little online programm that must save a football tournament results. I'm adding a team names using JS, and i want to save them on server site (in text file). For this i need PHP, i think. JS looks like this:
<script>
function addTeam(){
var name = $("#FormForNameEntering").val();
if (name != ""){
$("#TableDataNameContainer").append("<p class='teamName'>" + name + "</p>");
$('#FormForNameEntering').val("");
}
}
</script>
So i need to save variable "name" in text file. For this i need to tranfer its value to PHP? How?
You have three options. You would make an Ajax call, form submission of some kind with a submit button and action to be set to a php file, or finally have your whole page in a php file and after receiving data in JavaScript do your php there.
You need to send it to the server! e.g:
window.location = www.example.com?variableName='+yourJSVariable
And just retrieve it via PHP's $_GET. Other option you have is sending it to the server asynchronously (=in background lets say). Have a look at jQuery's ajax/get/post functions, or play around with XHR obj in js. Or try submiting via html forms.
Dont worry we've all started somewhere!
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Ways to circumvent the same-origin policy
i have this situation:
i have a form to be filled in my website, and in that form there is an input for a number that i have to check to see if it's a valid number or not.to check that this number is valid, there is another website and there is an input in that site which you can enter the number and if it is valid(it's registered in something) then it will show you the name of the person related to that number.
how can i do this...i wanna have a onBlur() function on the input in my website which do the trick for me, and if it's not valid alert it.
can you help?
btw, it's the website which checks if the number is valid:
http://portal.irimc.org/DoctorSearchEngine/Search.aspx
you enter a number(e.g. 12554) in the top input and it shows that it belongs to somebody and it's valid.
thanks.
It's impossible with client side javascript but possible with backend server support. From your website you get data from user and send with AJAX to your server, server load form from another website, fill it and get/parse response. Then return response for your Ajax request.
Read about sending POST/GET request's from server site.
Examples:
php - http://www.jonasjohn.de/snippets/php/post-request.htm
rails - http://blog.dougpetkanics.com/making-a-post-request-to-a-rails-api-endpoint
rails testing tool with webkit integration - https://github.com/jnicklas/capybara/
java - Is it possible to test Java application with Capybara?
See how easy is filling form with capybara:
def login!
within("//form[#id='session']") do
fill_in 'Login', :with => 'user#example.com'
fill_in 'Password', :with => 'password'
end
click_link 'Sign in'
end
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Making a hack proof game in Javascript
I'm building a very simple web game
In this game when player clearing all missions the total score should be posted to server .
question is : ajax params could be modified easily .
How to check if datas modified ?
There are several diferent solutions.
You can check you server script that processing your AJAX data, and then logged them.
Another way is to use your browser console. The most of the new Web Browsers are having console, that allowing you to check all the data of your web page, even the data you send or receive from the server with AJAX Calls.