1 Replies - 485 Views - Last Post: 06 January 2012 - 09:38 PM

#1 MySparetime  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 07-April 09

Javascript not working in a .php file that I have included with ajax

Posted 06 January 2012 - 08:46 AM

Hello,
I have started messing about with Ajax, And I managed to get the code working for when someone clicks on a <li> It will change the contents of a <div> with the content of a .php file, However In that Php file I also need to run some Javascript However it seems that it does not work.
The only Javascript that I can get working is:
<li onclick="alert('Test')">Press me </li>


However the following code does not work, This code I copied of w3school's website just to make sure if it was an error in my script
<html>
<head>
<script type="text/javascript">
function displaymessage()
{
alert("Hello World!");
}
</script>
</head>

<body>
<form>
<input type="button" value="Click me!" onclick="displaymessage()" />
</form>
</body>
</html>


So the only thing that I can think is wrong is that there is an issue with using javascript in a file that has been include with AJAX,
Am I right ?

Is This A Good Question/Topic? 0
  • +

Replies To: Javascript not working in a .php file that I have included with ajax

#2 rajesh.kakawat  Icon User is offline

  • New D.I.C Head

Reputation: 5
  • View blog
  • Posts: 43
  • Joined: 03-January 11

Re: Javascript not working in a .php file that I have included with ajax

Posted 06 January 2012 - 09:38 PM

You should send your full not working code.Instead your code is working which you have send
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1