Dec 05, 2008, 6:13 PM
[CLOSED] AjaxMethod Error = BADRESPONSE: Syntax error
I can't seem to get the most basic example of the AjaxMethod working. Below is a page that is one of the examples from the Coolite.Examples. It works in the examples, but not in my project. I'm using build 0.7.0.19508 in both cases. It returns the string 'BADRESPONSE: Syntax error'. If you put a breakpoint in the Server AjaxMethod, you will see it gets called.
Ive tried different return values, using AjaxResponse, making it static. Nothing seems to work!!!
Is there some kind of WebConfig requirement or some other esoteric setting that is needed?
Also, see my other outstanding post: http://forums.ext.net/showthread.php...4863-16-1.aspx for other problems I'm having with Ajax->Server calls.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test5.aspx.cs" Inherits="Test5" %>
<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script runat="server">
[AjaxMethod]
public string GetTimeStamp() {
return DateTime.Now.ToLongTimeString();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ext:Button ID="Button1" runat="server" Text="Run Test">
<Listeners>
<Click Handler="Coolite.AjaxMethods.GetTimeStamp({
success: function(result) {Ext.Msg.alert('Server Time', result);},
failure: function(result) {Ext.Msg.alert('Failed', result);}
});" />
</Listeners>
</ext:Button>
</form>
</body>
</html>