hi
i have an html input which is built from php and have an onclick function that calls the javascript function and sends some arrays to that function which are initialized via php and then passed to javascript function and then again submitted to a php file via an AJAX call but the problem is that when passed to the php file via AJAX it try to echo those arrays , they show me the following rather than the values
[code=error]
<pre>function Array() {
[native code]
}</pre></pre>function Array() {
[native code]
}<pre>function Array() {
[native code]
}</pre>
[/code]
here is the js function
[code=javascript]
var xmlGuestInfo=nu ll;
function getGuestInfo(mb r,id,t_days,typ e,t_guests,t_st ays,all_dates,u nique_dates,gue st_beds_arrange d){
var guest_name = document.getEle mentById("guest _name_"+id).val ue;
if(mbr=="" && guest_name=="") {
displayError("P lease Enter Guest Name to proceed.");
if(document.get ElementById("gu est_price_"+id) .value!=''){
document.getEle mentById("total _price").value= document.getEle mentById("total _price").value. substr(0,parseF loat(document.g etElementById(" total_price").v alue.length) - parseFloat(1))-parseFloat(docu ment.getElement ById("guest_pri ce_"+id).value. substr(0,parseF loat(document.g etElementById(" guest_price_"+i d).value.length ) - parseFloat(1))) +"$";
document.getEle mentById("guest _price_"+id).va lue='';
}
}else{
if(guest_name== "" && type=="MBR"){
displayError("P lease enter guest name before entering the MBR#");
}else if(guest_name== "" && type=="GST"){
displayError("P lease enter guest name");
}else{
var str=encodeURI(" guest_name="+gu est_name+"&memb er_id="+mbr+"&t _days="+t_days+ "&row_id="+id+" &t_guests="+t_g uests+"&t_stays ="+t_stays+"&al l_dates="+all_d ates+"&unique_d ates="+unique_d ates+"&guest_be ds_arranged="+g uest_beds_arran ged);
var url="index.php? option=com_rese rvations&task=c heckMember&form at=raw&"+str;
xmlGuestInfo=Ge tXmlHttpObject( );
if(xmlGuestInfo ==null){
alert("Please upgrade your browser");
return;
}else{
xmlGuestInfo.on readystatechang e=$getGuestInfo ;
xmlGuestInfo.op en("GET",url,tr ue);
xmlGuestInfo.se nd(null);
}
}
}
}
function $getGuestInfo() {
if(xmlGuestInfo .readyState==4) {
if(xmlGuestInfo .status==200){
alert(xmlGuestI nfo.responseTex t);
return;
}
}
}
[/code]
i have an html input which is built from php and have an onclick function that calls the javascript function and sends some arrays to that function which are initialized via php and then passed to javascript function and then again submitted to a php file via an AJAX call but the problem is that when passed to the php file via AJAX it try to echo those arrays , they show me the following rather than the values
[code=error]
<pre>function Array() {
[native code]
}</pre></pre>function Array() {
[native code]
}<pre>function Array() {
[native code]
}</pre>
[/code]
here is the js function
[code=javascript]
var xmlGuestInfo=nu ll;
function getGuestInfo(mb r,id,t_days,typ e,t_guests,t_st ays,all_dates,u nique_dates,gue st_beds_arrange d){
var guest_name = document.getEle mentById("guest _name_"+id).val ue;
if(mbr=="" && guest_name=="") {
displayError("P lease Enter Guest Name to proceed.");
if(document.get ElementById("gu est_price_"+id) .value!=''){
document.getEle mentById("total _price").value= document.getEle mentById("total _price").value. substr(0,parseF loat(document.g etElementById(" total_price").v alue.length) - parseFloat(1))-parseFloat(docu ment.getElement ById("guest_pri ce_"+id).value. substr(0,parseF loat(document.g etElementById(" guest_price_"+i d).value.length ) - parseFloat(1))) +"$";
document.getEle mentById("guest _price_"+id).va lue='';
}
}else{
if(guest_name== "" && type=="MBR"){
displayError("P lease enter guest name before entering the MBR#");
}else if(guest_name== "" && type=="GST"){
displayError("P lease enter guest name");
}else{
var str=encodeURI(" guest_name="+gu est_name+"&memb er_id="+mbr+"&t _days="+t_days+ "&row_id="+id+" &t_guests="+t_g uests+"&t_stays ="+t_stays+"&al l_dates="+all_d ates+"&unique_d ates="+unique_d ates+"&guest_be ds_arranged="+g uest_beds_arran ged);
var url="index.php? option=com_rese rvations&task=c heckMember&form at=raw&"+str;
xmlGuestInfo=Ge tXmlHttpObject( );
if(xmlGuestInfo ==null){
alert("Please upgrade your browser");
return;
}else{
xmlGuestInfo.on readystatechang e=$getGuestInfo ;
xmlGuestInfo.op en("GET",url,tr ue);
xmlGuestInfo.se nd(null);
}
}
}
}
function $getGuestInfo() {
if(xmlGuestInfo .readyState==4) {
if(xmlGuestInfo .status==200){
alert(xmlGuestI nfo.responseTex t);
return;
}
}
}
[/code]
Comment