This should be easy, I just cant catch what's the problem for almost an hour so maybe I'm missing something.
I want to create a responsive contact form without a "thank you" page, so I am using ajax.
I wrote all the code, this is my responce I get on my console:
Uncaught RangeError: Maximum call stack size exceeded
that keeps running infinitely.
This is my form:
<div id="contactform" style="position: relative; top: 180px; left: 50px;">
<table width="600px" class="contactform" >
<tr>
<td colspan="2"> Full Name: <br/> </td>
<td colspan="2"> <input type="text" id="fullname" /> </td>
</tr>
<tr>
<td colspan="2"> Phone Number: </td>
<td colspan="2"> <input type="text" id="telephone"/> </td>
</tr>
<tr>
<td colspan="2"> Email Adress: </td>
<td colspan="2"> <input type="text" id="email"/> </td>
</tr>
<tr>
<td colspan="2"> Subject: </td>
<td colspan="2"> <input type="text" id="subject" /> </td>
</tr>
<tr>
<td colspan="2"> Content: </td>
<td colspan="2"> <textarea rows="5" cols="50" id="text"> </textarea> </td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> <input type="button" class="link" value="Send" id="sendBtn" /> </td>
</tr>
</table>
</div>
this is my ajax code part from the .js file:
$('#sendBtn').click(function(){
//get info
console.log("dude!");
var fullname = $("#fullname").val();
var telephone = $("#telephone").val();
var email = $("#email").val();
var subject = $("#subject").val();
var text = $("#text").val();
//send info to php
$.ajax({
beforeSend: function() {
// $("#spin").html(spiner);
},
url: 'http://www.example.com/MYtest/contact.php',
type: "POST",
data: ({ "fullname": fullname, "telephone": telephone, "email": email, "subject": subject, "text": text }),
success: function (results){
// $("#spin").hide(spiner);
console.log(email);
//hide table
$('#contactform').hide('slow', function() {
// Use arguments.callee so we don't need a named function
$('#contactform').hide( "slow", arguments.callee );
});
//show textboxes
$('#aboutSuccess').show("slow");
}
});
});
and this is my content.php :
if(isset($_POST['email'])) {
$email_to = "[email protected]";
$email_subject = "You have a new email from example.com";
$fullname = $_POST['fullname'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$text = $_POST['text'];
$message = "Full Name: ". $fullname ."\n Telephone: ". $telephone ."\n Email: ". $email ."\n Subject: ". $subject ."\n \n Message: \n". $text;
mail($email_to, $email_subject, $message);
}
$('#contactform').hide( "slow", arguments.callee )which might callarguments.calleeimmediately when the element is already hidden. Why do you want to usearguments.calleeat all?