i am using responseXML property in javascript , but it shows an error that xml document ($strXml) is invalid, i dont know where is the problem in my code, plz help me
html file:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Home Page</title>
<script type="text/javascript" src="code.js"></script>
</head>
<body >
<form>
<input type="text" id="c开发者_C百科ode" name="code" size="10" />
<input name="submit" type = "button" onClick ="check()" value = "check" />
</form>
</body>
</html>
I would make sure there is no whitespace before the XML prolog. (i.e. the <?xml version="1.0" encoding="utf-8"?>
, which should be right at the beginning of the document)
Try rewriting the code after if ($code == $codee)
as
{
$product= $xml->createElement( 'product' );
$xml->appendChild( $product );
$pname = $xml->createElement('pname',$name);
$product->appendChild( $pname );
}
Append a timestamp to the url be sure that you get a fresh xml:
var url = "coding.php?cod=" + cod+'&'+new Date().getTime();
精彩评论