Find Jobs
Hire Freelancers

Do you know AJAX i need help

€100 EUR

Closed
Posted almost 9 years ago

€100 EUR

Paid on delivery
I have a PHP contact form that I'm using with jQuery's AJAX method, but I'm getting very strange results with the "success:" function. <?php $name = $_POST['name']; $email = $_POST['email']; $number = $_POST['number']; $message = $_POST['message']; $msg = "Name: $name\n"; $msg .= "Email: $email\n"; $msg .= "Number: $number\n\n"; $msg .= "$message\n"; $recipient = "[recipients here]"; $subject = "Contact Us - $name"; $mailheaders = "From:$email"; $success = mail($recipient, $subject, $msg, $mailheaders); if ($success) { echo ('Correct'); } else { echo ('Failed'); } header("Location: [website address here]"); ?> Here's the jQuery AJAX method: $("#contact-form").submit(function (event) { $.ajax({ type: "POST", url: '/lib/[login to view URL]', data: { name: $("#name").val(), email: $("#email").val(), number: $("#number").val(), message: $("#message").val() }, success: function (data) { //$("#contact-form")[0].reset(); alert(data); if(data === 'Correct') { alert('Data is correct'); } else if (data !== 'Correct') { alert('Data is not equal to correct'); } else { alert('Else statement'); } } }); [login to view URL](); return false; }); Now, when I fill in the form and click submit, the PHP receives the right data and successfully sends the email, and echo's "Correct". An alert pops up saying "Correct". But then, instead of the next alert being "Data is correct", it is "Data is not equal to correct". I have no idea what's going on here for that to happen. I'm assuming I must be making a really stupid mistake somewhere but can't seem to figure it out.
Project ID: 7593110

About the project

40 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
40 freelancers are bidding on average €103 EUR for this job
User Avatar
I am ready to start from now, please provide me FTP details where I can work. I am very sure to fix it. Waiting for your response.
€100 EUR in 1 day
4.9 (425 reviews)
8.3
8.3
User Avatar
i am ajax well, i can help you on this. i am ajax well, i can help you on this. i am ajax well, i can help you on this.
€100 EUR in 1 day
5.0 (465 reviews)
7.4
7.4
User Avatar
Dear Sir, I am really interested to work on this project . I have very good experience of doing this sort of job, I can start the work now and can assure the best service from my end. I am waiting here to discuss about your project , please come on chat. Regards,
€100 EUR in 0 day
5.0 (260 reviews)
7.1
7.1
User Avatar
First, I am sunsoftpro, I from VietNam. Nice to meet you! I have read your description and been interested in your project. I'm ready to discuss and do hard working so that complete great job. Please discuss before awarding the project.
€100 EUR in 1 day
4.7 (175 reviews)
7.6
7.6
User Avatar
Hi i have checked your code so being the expert in Ajax i can solve the issue and correct the code. Please reply to discuss. Thanks
€100 EUR in 1 day
4.8 (209 reviews)
7.0
7.0
User Avatar
could you let me take a look at the form? I'll show you a working version of it before you award me the project .
€100 EUR in 0 day
5.0 (191 reviews)
7.0
7.0
User Avatar
Hello Let's explore the requirement and kindly let us know if you would like us to share our skills & experiences with previous development. Thanks and Regards Audri
€102 EUR in 3 days
4.7 (98 reviews)
6.5
6.5
User Avatar
I am web developer with 4 yr of exp . Have done lots of similar jobs accept my bid will start now, also I have 100% completion on time and good review, I am new here I just need good rating.
€100 EUR in 0 day
5.0 (118 reviews)
5.8
5.8
User Avatar
Hey Man, it's just a data type mismatch. Just make it JSON type and it will work. also we need to trim the string for spaces. Just give me access to code and I will fix in couple of minutes. Thanks, datta
€111 EUR in 0 day
4.8 (40 reviews)
5.8
5.8
User Avatar
Hello Sir I read your requirement and able to do make ajax working within 2 hours. IF its not complete within 2 hours then don't give payment. i am dam sure i will complete within 2 hours.. Please give a chance i am sure you will be very happy after 2 hours after i will find best optimize solution. Thanks
€111 EUR in 1 day
5.0 (40 reviews)
5.5
5.5
User Avatar
I can do this
€111 EUR in 0 day
5.0 (20 reviews)
5.4
5.4
User Avatar
Hi, after going through the code, I got to an agreement that you are making an stupid mistake. Using text/html MIME Type for AJAX requests, and using capital letters in response body are wrong. By the way, you cannot use header(); with Location in AJAX. it is useless and cause this problem since the final header response is 302 instead of 200. I believe that I can fix your problem within 2 hours. I will make your code very organized, and work as it should be; yours is very messy. Regards, Adam A.
€100 EUR in 0 day
4.8 (55 reviews)
5.8
5.8
User Avatar
Hello, Nice to meet you. I am Manh from vietnam. I have 8 years experience in Software development. I am very good at AJAX. I understand your requirements and very interested in your project. Please feel free contact me. We can discuss further on your project. Thank you and have a good day
€111 EUR in 1 day
5.0 (28 reviews)
4.9
4.9
User Avatar
Hello, I am akil khatri with my 25+ member team with limited skills and unlimited ideas in Game Development|iPhone|Android|Mobile App Development|PHP|Joomla|Wordpress|Javascript|Java| and |.Net|3D Animation|3D Max| within 5+ year experience and i give my 100% to my work and my past work show my ideas creativity and quality and client satisfaction which is my first responsibility and my aim is highest return of my client investment which will show my work and help to increase your business and i feel success when i do job on deadline.. Thanks &Regards, Akil Khatri
€105 EUR in 3 days
4.5 (54 reviews)
5.2
5.2
User Avatar
Dear Employer, I have 10 years experience in Web Programming. I have reviewed your requirements very carefully and is interested to start this project right now. Please contact me to discuss this project. My Qualifications, Experience and Skills: - University degree in computer science. - Ten years' relevant professional experience in software development. - Very good knowledge of PHP programming language and related web technologies (HTML, CSS, Javascript, AJAX). - Experience in development and maintenance of relational databases (MySQL). - Practical knowledge of code versioning tools (GIT). Waiting for your kind respond on my bid. Regards, Robert
€111 EUR in 3 days
4.9 (20 reviews)
4.7
4.7
User Avatar
Hi, I'd be glad to help you! My real bid would be 15EUR; We can make this work in a few minutes. I am a freelancer working from the comfort of my home and i'm doing only this work. I work for clients by myself. I have experience with PHP, MySQL, Javascript, HTML5, CMS , Wordpress,Graphic Design, Microsoft Office, Adobe Suite.
€100 EUR in 1 day
5.0 (24 reviews)
4.4
4.4
User Avatar
A proposal has not yet been provided
€100 EUR in 0 day
4.6 (7 reviews)
4.7
4.7
User Avatar
Hi, I can fix it right away. I think this issue is soem character or return type problem. I have handled this type of issues many times. I would liek to chat with you and ready to start ASAP. Thanks & Regards Rijo Joy
€100 EUR in 0 day
5.0 (14 reviews)
3.9
3.9
User Avatar
I have designed and developed more than 200 websites as of now. I have great expertise in PHP, Wordpress ,Laravel, Cake PHP, Javascript, Jquery,Ajax, Mysql, HTML,CSS, Webservices, Linux, Apache, 3rd party API’s like Payment Gateways(Moneybookers,Paypal,Endeavour etc),SMS,API, Facebook ,Twitter, Gmap and many more. In linux os- LAMP server installation, ssl configuration, virtual hosting of websites on server, monitoring etc. I will strictly adhere to the timeline and can start immediately. Please let me know when to start. If I am awarded this project I will give you three guarantees: 1. I will strictly follow the deadline. 2. 100% accuracy otherwise I will not accept money. 3. I will always be available on Skype/Email. I can start immediately. Since I have to build reputation on Freelancer. So let’s start our professional relationship. Thank You! PS: I am also expert in ajax.
€100 EUR in 3 days
5.0 (13 reviews)
3.8
3.8
User Avatar
hi we can fix it within 5 minutes,
€105 EUR in 0 day
4.9 (14 reviews)
3.9
3.9

About the client

Flag of SRI LANKA
Sri Lanka
0.0
0
Member since Apr 30, 2015

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.