1

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..!!

1
  • Show your actual code. Commented Apr 6, 2014 at 15:18

4 Answers 4

3

Your code should be:

echo '<script type="text/javascript">alert("message")</script>';
Sign up to request clarification or add additional context in comments.

Comments

0

You need to wrap it in HTML script tags:

echo '<script>alert("message");</script>';

2 Comments

They did, but it just wasn't showing up in their code example.
@BillTurner Then this should work. Except you have replaced the default JS alert with the one from jQuery UI and have not included the UI stylesheets. …or something alike
0

Probably you execute this code directly by the response from AJAX, or something went wrong with other JS code in your page.

1 Comment

You propably right.. Im using it under if (isset($_POST['submit'])){
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.