Hi guys, i need to save a record in the cases module when user clicks on a custom button created by me. So far i have done the following things,
--Added the button in detail view of cases module
--Created a javascript file which gets called successfully when i click on the button
--Created a php file which is called by ajax from this javascript file and has the code to save record in the database
Now i want to return something from this php file to my javascript and show an alert to the user.
For example if the php file returns HELLO WORLD, i want to show HELLO WORLD as an alert using javascript.
i did alert(xmlhttp.responseText) but it gives me the source code of the complete page instead of the value that my php returns.
Here is my javascript
---------------------------------------------------------------------------------------------------------------------------------
function getSessionKey(url)
{
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)
{
response = xmlhttp.responseText;
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
alert(response);
}
---------------------------------------------------------------------------------------------------------------------------------
Is there something i am missing??
Can some one help?
Thanks


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks