Corrupted ajax result

I am using the following html page:

<html>

<head>

<title>AJAX Example</title>

<meta http-equiv="Content-Type" content="text/html"; charset="iso-8859-1">

</head>

<script language="JavaScript" src="ajaxlib.js"></script>

<!--define the ajax javascript library-->

<body>

Click this <a href="#" OnClick="GetEmployee()">link</a> to show ajax

content (will be processed backgroundly without

refreshing whole page)<br/>

<!--a href=# OnClick=GetEmployee() is the javascript event on a

link to execute javascript function (GetEmployee) inside ajaxlib.js-->

<div id="Result">< the result will be fetched here ></div>

<!--javascript use GetElementById function to replace the data

backgroundly, we use <div> tag with  id Result here so javascript

can replace this value-->

</body>

</html>

      

Javascript is here: http://www.nomorepasting.com/getpaste.php?pasteid=22046

And PHP is here: http://www.nomorepasting.com/getpaste.php?pasteid=22047

The problem is that everything seems logical and there are no errors, but the javascript does not seem to be called and calling the php file directly gives this result:

Well the characters won't even insert, apparently .... but a lot of little boxes with this:

10
01

      

0


source to share


2 answers


To begin with, your function getEmployee()

should return false;

prevent the default action on <a>

. Small boxes seem to imply character sets are not the same. Make sure the HTML page and PHP page are using the same character set. I suggest trying to make everything UTF-8.



Edit: Read wrong - I think the character set being output by PHP does not match the character set in your database.

+1


source


I suggest adding a data padding to Firefox +. You will be able to find out if your browser is loading javascript and also view the ajax + data to see what is going on. Also check the error console for JavaScript errors. I would start there.



0


source







All Articles