1

here is my script I am playing with jQuery Ajax form submit, without success. All I got to my ajax query is an empty result. You can check my code from the source. I don't copy it here, because it is long, I hope it's not problem.

JS

I am trying to get response from send.php.

PHP code is simple:

return $_POST['field2'].$_POST['field1'].$_POST['m'];
1
  • 2
    You need to echo the data from your PHP script, not return it. Commented Feb 27, 2012 at 21:51

1 Answer 1

2

In the PHP code, Instead of return use echo.

echo $_POST['field2'].$_POST['field1'].$_POST['m'];

return should only be used in a function to return a variable while echo can actually print the string for use by JS.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.