|
Yet another person trying to get the quick guide to work -- ShandySawyer --
Ok, I have tried EVERYTHING that has been listed to make quick guide sample to work. I even downloaded Joseph Guadagno's VB project http://josephguadagno.net/ajax.aspx that he says is working fine and tried to run it but it didn't work. The javascript error i'm getting is: Line: 19 Char: 1 Error: Object Expected Code: 0 URL: http:// /employerprofiles/default.aspx Its refering to this line of code in the default.aspx: <button onclick="GetServerTime();" type="button">GetServerTime</button> Here's all my stuff: Just some quick side notes - The folder employerprofiles is a subweb. So any paths that start at the root under this project are really starting at /employerprofiles/ - A reference was added to the project for the AjaxPro.dll (I'm using ASP.NET 1.1) ----------------- /web.config ----------------- <httpHandlers> <!-- Register the ajax handler --> <add verb="POST,GET" path="ajax/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro" /> </httpHandlers> ------------------ /default.aspx ------------------<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb" Inherits="EmployerProfiles.TestAJAX"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhmtl1-strict.dtd "><HTML> <HEAD> <title>default</title> <script language="javascript" src="/javascript/TestAJAX.js"></script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <button onclick="GetServerTime();" type="button">GetServerTime</button> </form> </body></HTML>---------------------- /default.aspx.vb ---------------------- Public Class TestAJAX Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(EmployerProfiles.TestAJAX)) End Sub <AjaxPro.AjaxMethod()> _ Public Function GetServerTime() As String Return DateTime.Now.ToString() End Function End Class ------------------------------- /javascript/TestAjax.js ------------------------------- function GetServerTime() { EmployerProfiles.TestAJAX.GetServerTime(GetServerTime_Callback)} function GetServerTime_Callback(response) { alert(response.value); } If anyone can tell me at all what is wrong and how to fix it they will be in my hall of coding fame forever :) Thanks! Shandy |
|
-- ShandySawyer --
Well Ok I figured out one thing. Even though its in a subweb, any references to a javascript file have to include the WHOLE path. Yup i'm a genius. But now I'm getting this error: Line: 4Char: 2Error: "EmployerProfiles" is undefined Code: 0URL: http:// /employerprofiles/default.aspx Anyone have an explanation? I tried surrounding my class with a namespace and then redefined my functions in the javascript file with that namespace but the same error occurred. Shandy From: sawski: ajaxpro: Yet another person trying to get the quick guide to workDate: Tue, 18 Jul 2006 14:34:46 -0700 Ok, I have tried EVERYTHING that has been listed to make quick guide sample to work. I even downloaded Joseph Guadagno's VB project http://josephguadagno.net/ajax.aspx Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(EmployerProfiles.TestAJAX)) End Sub <AjaxPro.AjaxMethod()> _ Public Function GetServerTime() As String Return DateTime.Now.ToString() End FunctionEnd Class ------------------------------- /javascript/TestAjax.js-------------------------------function GetServerTime() { EmployerProfiles.TestAJAX.GetServerTime(GetServerTime_Callback)} function GetServerTime_Callback(response) { alert(response.value); } If anyone can tell me at all what is wrong and how to fix it they will be in my hall of coding fame forever :) Thanks! Shandy Be one of the first to try Windows Live Mail beta |
|
-- Zozi --
I think, you have to test your web ajax applications in FireFox. (Whit web developer tool). It'll help you. In FireFox you get a normalize error message, and usually the error console shows you, where the problem is. And one more thing. Check out the included javascript directly by url. Maybe the include path is wrong. Zozi Shandy Sawyer wrote: http://josephguadagno.net/ajax.aspx that he says is working fine and tried to run it but it didn't work.The javascript error i'm getting is: Line: 19 Char: 1 Error: Object Expected Code: 0 URL: http:// /employerprofiles/default.aspx Its refering to this line of code in the default.aspx: <button onclick="GetServerTime();" type="button">GetServerTime</button> Here's all my stuff: Just some quick side notes - The folder employerprofiles is a subweb. So any paths that start at the root under this project are really starting at /employerprofiles/ - A reference was added to the project for the AjaxPro.dll (I'm using ASP.NET 1.1) ----------------- /web.config ----------------- <httpHandlers> <!-- Register the ajax handler --> <add verb="POST,GET" path="ajax/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro" /> </httpHandlers> ------------------ /default.aspx ------------------<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb" Inherits="EmployerProfiles.TestAJAX"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhmtl1-strict.dtd "><HTML> <HEAD> <title>default</title> <script language="javascript" src="/javascript/TestAJAX.js"></script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <button onclick="GetServerTime();" type="button">GetServerTime</button> </form> </body></HTML>---------------------- /default.aspx.vb ---------------------- Public Class TestAJAX Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(EmployerProfiles.TestAJAX)) End Sub <AjaxPro.AjaxMethod()> _ Public Function GetServerTime() As String Return DateTime.Now.ToString() End Function End Class ------------------------------- /javascript/TestAjax.js ------------------------------- function GetServerTime() { EmployerProfiles.TestAJAX.GetServerTime(GetServerTime_Callback)} function GetServerTime_Callback(response) { alert(response.value); } If anyone can tell me at all what is wrong and how to fix it they will be in my hall of coding fame forever :) Thanks! Shandy |
|
-- ShandySawyer --
Zozi, I haven't had a chance to use FireFox since someone else is in need of my laptop. At work our server admin only allows IE so it can make things difficult. Anyways I tried different paths, even the absoluate path with http:// but I believe the src for the url is correct. I tried the same url except using a css file and applied some different styles to the page and it worked fine. Anyways I am trying to work out the issue over at another post "Newbie trying to get started..." http://groups.google.com/group/ajaxpro/browse_frm/thread/c2374d25bc2861e4/eca2bb6db5f3d5ff#eca2bb6db5f3d5ff It has more information on how we have tried to fix this issue. Thanks for the help! |