Reputation: 13
I'm new to the programming world, so take it easy.. I'm running some tests and i realise that when I use jQuery libraries outside of php to create a form, the echo inside the php doesn't work. I actually want an alert message but I found out that this can be done with
echo "<script>alert ('message')</script>";
but anyway echo is responsible for not seeing anything.. Is the problem the jQuery libraies (which I don't really think so..) or I'm just not knowing what I'm doing..?
What code could I use..?
Thank you in advance..!!
Upvotes: 1
Views: 7598
Reputation: 13
Got it..!! I realise that with jQuery libraries the page refresh too fast after i submit my form and my code runs.. the fast refreshing doesn't leave any time to the alert message to pop-up. So that's it.. When i use my page without jQuery libraries takes a longer time to refresh after i submit and the pop-up.. well pops-up
Upvotes: 0
Reputation: 184
Probably you execute this code directly by the response from AJAX, or something went wrong with other JS code in your page.
Upvotes: 0
Reputation: 144
Your code should be:
echo '<script type="text/javascript">alert("message")</script>';
Upvotes: 3
Reputation: 29932
You need to wrap it in HTML script
tags:
echo '<script>alert("message");</script>';
Upvotes: 0