Quote:
|
my problem is the jquery-1.4.2.min.js conflicted with something else on the page that needed the jquery.js
|
I really doubt this. The newest jq is ver 1.7.2.
My thoughts on the code is, don't use html to mean the results that the called file sends back. It does work, but html has another meaning so why confuse things. Use
Code:
success: function (result) {
Your file name needs to be in quotes. Is this the real file name
? Or a representation of it?
Code that works:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script src="./lib/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("button").click(function(){
$.ajax({
url: "ajax.php",
cache: false,
success: function (result) {
$("#mydiv").html(result);
}
});
});
});
</script>
</head>
<body>
<div id="mydiv">Ajax will write here</div>
<button>Do AjAx Stuff</button>
</body>
</html>
My ajax.php file is this:
PHP Code:
<?php
echo 'made it';
?>