how to get a php-builded HTML string, in a Javascript variable, from AJAX request ?
Hello,
What I need to get is something like this :
- <script>var my_var = "<p>Hello</p>";
But I need this content to be builded in PHP, from an external file.
So I tried this :
- var my_var = $.ajax({
type: "POST",
url: "<?php echo $config["root_url"]; ?>/www/ajax_queries.php",
data: "action=build_form_for_inscription_CN&event_id=" + event_id,
}).responseText;
In my ajax_queries.php file, I have :
- $str = "<p>test</p><strong>retest</strong>";
- echo $str;
But I don't receive it in my my_var JS variable.
How can I do ?