Ajax Help!?!?!??
Page 1 of 1
Ajax Help!?!?!??
Hey, I have this code - I don't know why this code doesn't work, there are no errors (according to my browser Inspect Element) so can anyone help me find and resolve my problem?JavaScript code:
- Code: Select all
//AJAX STUFF
$(document).ready(function()
{
$('#bluebgradio').click(function()
{
$.ajax(
{
type: "POST",
url: profile.php,
data: {blueBGhas: "yes"}})
.done(function()
{
alert("Hello");
});
});
});
Re: Ajax Help!?!?!??
try like this- Code: Select all
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>
</head>
<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>
</html>
Re: Ajax Help!?!?!??
in the place ofajax_info.txt you should use the file name of your php script like you use in
<form action="ajax_info.txt" method="get" />
Re: Ajax Help!?!?!??
But that is just displaying stuff from another place.How do I send stuff using the code I had?
I need to send data to a url: profile.php
Will my code do that correctly?
Re: Ajax Help!?!?!??
Never mind, a different code help site figured out the problem for me:I needed to put quotes around profile.php...
Thanks anyway
Re: Ajax Help!?!?!??
ok glad you did it..Page 1 of 1