473,385 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Ajax POST and GET which one i should use.

62
Hi,
I have problem about ajax GET method.
I use ajax to send mail and i use method GET.
when i send alittle bit data it's work good but once i
type so much in the form and send...i don't get any mail .
i tried many time but it did not help except i will not type so much
then main will be sent...why ?

do i haver to change methos to POST?
what is different and how ?


I always appreciate every help
alex
Jan 17 '08 #1
11 1725
Markus
6,050 Expert 4TB
Hi,
I have problem about ajax GET method.
I use ajax to send mail and i use method GET.
when i send alittle bit data it's work good but once i
type so much in the form and send...i don't get any mail .
i tried many time but it did not help except i will not type so much
then main will be sent...why ?

do i haver to change methos to POST?
what is different and how ?


I always appreciate every help
alex
GET has restrictions on how much data can be passed through the URL - i'm not sure how large the restrictions are, but there definitely is some.

POST, however, does not have restrictions on the amount of data sent.. i think; either way it's much, much larger than GET.

To change to POST isn't hard and sounds like what you need!

Best of luck.
Jan 17 '08 #2
acoder
16,027 Expert Mod 8TB
See this POST example.
Jan 18 '08 #3
paitoon
62
Thak you so much i will try..:-)
Jan 18 '08 #4
paitoon
62
Actually it's not so hard to change method from GET to be POST in ajax file...
But how about PHP? i see it not work at all...
could u please give me a example easiest php send mail which get from POST ajax in this cast ?

Thank you so much
Alex


here is what i do but i did not get any mail at all.
[php]<?php

$recipient = 'mymail@hotmail.com';
$subject = $_POST['subject']
$from = $_POST['from']
$email = $_POST['email']
$text = $_POST['text']
$ip = $_SERVER['REMOTE_ADDR'];

$msg = "From: $from\n Email: $email \n IP Adrress :$ip \n\n Message: $text";
mail($recipient, $subject, $msg);

?>[/php]
Jan 18 '08 #5
acoder
16,027 Expert Mod 8TB
First make sure it's working without Ajax.
Jan 18 '08 #6
paitoon
62
yes..i check it and everything is work good if i use GET method..
But i need to use POST method but it not work here.
Here is additional thing that i want to tell you

var params = "$sender=" + encodeURIComponent(document.iform.sender.value)+
"&$email=" + encodeURIComponent(document.iform.email.value)+
"&$subject=" + encodeURIComponent(document.iform.subject.value)+
"&$text=" + encodeURIComponent(document.iform.text.value);

The params varialable be sent by

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send(params)

But what should i do with PHP `

best regards
Alex
Jan 18 '08 #7
Amzul
130 100+
Actually it's not so hard to change method from GET to be POST in ajax file...
But how about PHP? i see it not work at all...
could u please give me a example easiest php send mail which get from POST ajax in this cast ?

Thank you so much
Alex


here is what i do but i did not get any mail at all.
[php]<?php

$recipient = 'mymail@hotmail.com';
$subject = $_POST['subject']
$from = $_POST['from']
$email = $_POST['email']
$text = $_POST['text']
$ip = $_SERVER['REMOTE_ADDR'];

$msg = "From: $from\n Email: $email \n IP Adrress :$ip \n\n Message: $text";
mail($recipient, $subject, $msg);

?>[/php]
if you copy paste this code u missing ";"

Expand|Select|Wrap|Line Numbers
  1. $subject = $_POST['subject']
  2.    $from = $_POST['from']
  3.    $email = $_POST['email']
  4.    $text = $_POST['text']
check your logs to see the error u getting and post it here
Jan 18 '08 #8
paitoon
62
[quote=paitoon]Actually it's not so hard to change method from GET to be POST in ajax file...
But how about PHP? i see it not work at all...
could u please give me a example easiest php send mail which get from POST ajax in this cast ?

Thank you so much
Alex


here is what i do but i did not get any mail at all.
<?php
$params = $_POST[params];
$recipient = 'geisha_hi-so@hotmail.com,ffffftmnsr@mahidol.ac.th';
$subject = $_SERVER['subject'];
$from = $_SERVER['from'];
$email = $_SERVER['email'];
$text = $_SERVER['text'];
$ip = $_SERVER['REMOTE_ADDR'];

$msg = "From: $from\n Email: $email \n IP Adrress :$ip \n\n Message: $text";
mail($recipient, $subject, $msg);

?>
Jan 18 '08 #9
paitoon
62
I did everything but alll is does not help
i think i have to do something with php..
i send variable params from javascrip which contents

var params = "$sender=" + encodeURIComponent(document.iform.sender.value)+
"&$email=" + encodeURIComponent(document.iform.email.value)+
"&$subject=" + encodeURIComponent(document.iform.subject.value)+
"&$text=" + encodeURIComponent(document.iform.text.value);

and i have to do something with variable params in PHP
but i don't know how .....?
i guess or what do you think ?

thanks
Alex
Jan 18 '08 #10
paitoon
62
yesssssssssssssssss!! i got it
all is because i did not put the $params = $_POST['params']; in PHP
But now everything is work great :-)

thank you everybody here
Alex
Jan 18 '08 #11
acoder
16,027 Expert Mod 8TB
I did think there must've been a problem in your PHP. Glad you got it working.
Jan 19 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
9
by: GTi | last post by:
I have a bizare Ajax POST problem. I use Ajax POST to send data to the server. The server get the POST and answer back. BUT if I POST the data once again I recieve the same answer that the first...
1
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest...
0
by: BlipBlip | last post by:
Hi All, I was not sure which forum to post the message to since the problem related to ASP/AJAX, but decided to post it here. I have a simple routine which utilizes an Ajax to query database for...
8
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm about to finally make the jump and start a new site using AJAX. THe question i have for all of you AJAX developers out there is which one? 1. The Standard AJAX frame work 2. The Tool kit....
10
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
controlsPlease could some of you here post some of your live examples of AJAX (esp drag panels, collapsable panels, and popup menu.) (It's one thing to talk about how great something is, but it's...
1
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.