Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

How can I load this text into a div?

So I've got a function in PHP. If no records are found as a result of a SELECT statement, then right now, the syntax I'm working on has this:

echo "We were unable to match the info you provided.";

I want to instead, load some text via JQuery into a div. Right now, I've got this:

echo "<script>$('#header_text').html('We were unable to match the information you provided.\n Please try again.');</script>";

It's not working. I think I know why in that what I've got currently is something that's put in motion by an action of some kind. A click, a button - something. Without that "event," I don't have anything.

Let me know if that's accurate and, if you would, also tell me how I can use JQuery to load some new text into the <div> rather than simply echoing a message.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Leonidas Dosas
Leonidas Dosas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

I got it to work boys, but I'm not out of the woods yet. If you could look at my question at https://www.experts-exchange.com/questions/29045393/How-can-I-get-this-to-work.html, I would very much appreciate it.

Thanks!