We help IT Professionals succeed at work.

Getting a javascript Expected_';"

Jim Faust
Jim Faust asked
on
Attempting to create a Cisco IP phone service. Following exact guidelines of one that does work;
Have logging enabled.

I get a 500 server error on the phone; very generic.
On the log, I get this -

(cs-uri-query field of the log)
ctype=out|4|800a03ec|Expected_';'

Can someone please tell me where I'm going wrong?
Code is attached.
thanks - Cindy

<%@ Language=JavaScript %>
<% 
var serverIP = Request.ServerVariables("LOCAL_ADDR");
var SERVICE_DIR="CiscoIPServices";

function MainMenu()
{	Response.Write("<CiscoIPPhoneMenu><Title>IP Time Clock</Title><Prompt>Choose a selection:</Prompt>\r\n");
	Response.Write("<MenuItem>\r\n");
	Response.Write("<Name>Clock In</Name>\r\n");
	Response.Write("<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/menu.asp?option=in</URL>\r\n");
	Response.Write("</MenuItem>\r\n");

	Response.Write("<MenuItem>\r\n");
	Response.Write("<Name>Clock Out</Name>\r\n");
	Response.Write("<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/menu.asp?option=out</URL>\r\n");
	Response.Write("</MenuItem>\r\n");
	Response.Write("</CiscoIPPhoneMenu>\r\n");
	return;
}

function Menu()
{	Response.Write("<CiscoIPPhoneMenu>\r\n");
	Response.Write("<Prompt>Select an option</Prompt>\r\n");

	//Clock In
	Response.Write("<MenuItem>\r\n");
	Response.Write("<Name>Clock In</Name>\r\n");
	Response.Write("<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/input.asp?ctype=in</URL>\r\n");
	Response.Write("</MenuItem>\r\n");

	//Clock Out
	Response.Write("<MenuItem>\r\n");
	Response.Write("<Name>Clock Out</Name>\r\n");
	Response.Write("<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/input.asp?ctype=out</URL>\r\n");
	Response.Write("</MenuItem>\r\n");

	Response.Write("</CiscoIPPhoneMenu>\r\n");
}

	var opt=Request.QueryString("option");
	Response.ContentType = "text/xml";
	Response.Buffer = true;
	Menu();

	Response.Flush();
%>

Open in new window

Comment
Watch Question

Michel PlungjanIT Expert
Top Expert 2009

Commented:
I would return concatenated strings instead of response writing them in your functions.

However there is nothing I can see should give you this issue
<%@ Language=JavaScript %>
<% 
var serverIP = Request.ServerVariables("LOCAL_ADDR"+
var SERVICE_DIR="CiscoIPServices";

function MainMenu() { 
  return "<CiscoIPPhoneMenu><Title>IP Time Clock</Title><Prompt>Choose a selection:</Prompt>\r\n"+
  "<MenuItem>\r\n"+
  "<Name>Clock In</Name>\r\n"+
  "<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/menu.asp?option=in</URL>\r\n"+
  "</MenuItem>\r\n"+

  "<MenuItem>\r\n"+
  "<Name>Clock Out</Name>\r\n"+
  "<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/menu.asp?option=out</URL>\r\n"+
  "</MenuItem>\r\n"+
  "</CiscoIPPhoneMenu>\r\n";

}

function Menu()
{  
  return "<CiscoIPPhoneMenu>\r\n"+
  "<Prompt>Select an option</Prompt>\r\n"+

  //Clock In
  "<MenuItem>\r\n"+
  "<Name>Clock In</Name>\r\n"+
  "<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/input.asp?ctype=in</URL>\r\n"+
  "</MenuItem>\r\n"+

  //Clock Out
  "<MenuItem>\r\n"+
  "<Name>Clock Out</Name>\r\n"+
  "<URL>http://" + serverIP + "/" + SERVICE_DIR + "/timeclock/input.asp?ctype=out</URL>\r\n"+
  "</MenuItem>\r\n"+

  "</CiscoIPPhoneMenu>\r\n";
}

  var opt=Request.QueryString("option");
  Response.ContentType = "text/xml";
  Response.Buffer = true;
  Response.write(Menu());

  Response.Flush();
%>

Open in new window

I can't see anything wrong with your functions or the XML that they output.
However, I do not know the API for the Cisco IP phone. To me it seems the error is coming from there.
Or is it from input.asp?
I can't see that code so I don't know why it is complaining.
Ctype is a system function name in dotnet so the parameter naming choice might not be the best possible.
Sr. Data Quality Engineer / Independent Consultant
Commented:
The error was coming from the input.asp page - elseif is 2 words in javascript.
Thanks for taking a look. much appreciated.
Jim FaustSr. Data Quality Engineer / Independent Consultant

Author

Commented:
Solution was on page not given to experts to review.
Again, couldn't see that code.  Yes that sort of thing can get you.