i am tying to pass checkbox value and textbox value to this fuction and make xmlhttpreqest post request. Initial i used :
req.send("msg="+url);
and i posted msg only and it worked but when i try to post both msg and url it does not work. could any one look at this and let me know what i am doing wrong. I check using alert the data get passed corectly. Thanks
req.send("msg="+url&"url="+text);
req.send("msg="+url);
and i posted msg only and it worked but when i try to post both msg and url it does not work. could any one look at this and let me know what i am doing wrong. I check using alert the data get passed corectly. Thanks
req.send("msg="+url&"url="+text);
Code:
<script>
// Make a POST to the server
// and pass on any data from browser
// via the XMLHTTPRequest
function talktoServer3(){
var req = newXMLHttpRequest();
//register the callback handler function
var callbackHandler = getReadyStateHandler(req, updateMsgOnBrowser);
req.onreadystatechange = callbackHandler;
//req.open("POST", "servertime.php", true);
req.open("POST", "pushurl.php", true);
req.setRequestHeader("Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded");[/URL]
//get the value from the text input element and send it to server
//geting textbox data this next line
var text = document.getElementById('testmsg').value;
totalvotes = document.forms.mp3Play.totalvotes;
tempUrl ='';
url = '';
if (totalvotes.length > 0){
for (i=0; i<totalvotes.length; ++ i)
{
if (totalvotes[i].checked)
{
tempUrl =tempUrl + totalvotes[i].value +","
if (i == 30)
{
alert("Each time you can only select 30 songs to play")
return false;
}
}
}
}
else
{
alert("it is less than 0#2")
tempUrl = tempUrl + "&totalvotes=" + totalvotes.value
}
var url = "" + tempUrl.replace(/,$/,"");
req.send("msg="+url&"url="+text);
}