2013-03-28 17:37
浏览 74

如何将php变量传递给jquery AJAX?

I have started learning jquery AJAX. I have run into a problem, and was wondering if you guys could help me. I am trying to pass a php variable back to jquery, but it displays as [object Object]. I will be posting my code below.


<!DOCTYPE html>
<script src="//">
    $("button").click(function() {

<p>This is a test!</p>
<button>Click Here</button>


    $message = "Another test!";
    echo $message;

So what is it that I need to do to pass php variable $message into the paragraph using jquery ajax?

I know I could simply do if I changed index.html to index.php, but then if $message later changes, I have to reload the page. I am trying to learn how to make dynamic content without having to reload the page.

Thanks ahead of time for any help you provide! :-)

3条回答 默认 最新

相关推荐 更多相似问题