|
Problems with Firefox and Safari. Also, what's up with the $('syntax') ? -- Jeremy --
Hello all. I'm trying to write a very simple program using AJAX .NET. I've been able to get it to work in IE, but it fails in Firefox and Safari. It seems like the Starter Kit that I downloaded works fine in Firefox and Safari, so I think that there must be something special that one needs to do to make their AJAX .NET code work in these browsers. My code is as follows: This is in my .aspx : This is in my .aspx.cs : public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(Default)); } public string GetTomato() { return "You are eating a tomato!"; } public string GetPotato() { return "You are eating a potato!"; } public string GetSpaceSuit() { return "You are eating a spacesuit!"; } } And, finally, this is in my .js : vTomato = document.getElementById("tomato"); vPotato = document.getElementById("potato"); vSpacesuit = document.getElementById("spaceSuit"); addEvent(vTomato, "click", GetTomato); addEvent(vPotato, "click", GetPotato); addEvent(vSpacesuit, "click", GetSpaceSuit); function GetTomato(ev) { Default.GetTomato(GetTomato_Callback) } function GetTomato_Callback(response) { output.innerText=response.value; } function GetPotato(ev) { Default.GetPotato(GetPotato_Callback) } function GetPotato_Callback(response) { output.innerText=response.value; } function GetSpaceSuit(ev) { Default.GetSpaceSuit(GetSpaceSuit_Callback) } function GetSpaceSuit_Callback(response) { output.innerText=response.value; } Strangely enough, no errors show up in Firefox's Javascript console. However, pressing any of my AJAX buttons causes a full page refresh. Also, one other question - in the Starter Kit, I see page elements referred to using a dollar sign, quotes, and parens, like so : $("element").innerHtml = foo; When I try to use this in my own project, it throws errors. Is this something specific to AJAX .NET? Thanks again for your help. |