Visual Basic .NET » Web Forms
Problems with Firefox and Safari. Also, what's up with the $('syntax') ? -- Jeremy --


Thank you for your help.

I tried all of your suggestions, but, unfortunately, the code still doesn't work in Firefox of Safari. I went ahead and defined my output element as a variable. I also put in the conditional statement that Rui Liu suggested. I replaced innerText with innerHTML, which Firefox is supposed to support. I also tried outputting text using element.firstChild and element.appendChild. No luck. No matter what I did, I still got the same result in Firefox and Safari - a full page refresh. IE, on the other hand, worked fine.

Interestingly enough, when I replaced the buttons with images, the code worked in Safari and IE. However, it was still broken in Firefox. In Firefox's Javascript console, I got the following two errors :

Error: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE)
"
nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx 

Source File:
http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx 
Line: 321

Error: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE)
"
nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx 

Source File:
http://www.nerve.com/TestAjaxPro/ajaxpro/core.ashx 
Line: 321

Does anybody know what these exceptions mean?

Maybee you should start freshup your JavaScript and DOM knowledge.

Albert, you are correct - I am pretty new to JavaScript. However, I didn't think that you had to be a JavaScript wizard in order to get AJAX .NET to work with Firefox and Safari. 


I wish that the creator of AJAX .NET or the community would produce a set of easy example code that I could follow. All of the example code in the starter kits is too complex. I'm sure they will be helpful once I'm familiar with the library, but they aren't helping me to get started.

I would think that what I'm trying to do is easy - display text after someone clicks on a button or image. It works fine in IE, but Firefox and Safari are giving me trouble.

Thanks to all for your help. Below is the latest revision of my code
:

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!";
}
}

This is in my .js :
if (document.all)
{
vTomato = document.all
;
vPotato = document.all
;
vSpaceSuit = document.all
;
}
else if (document.getElementById)
{
vTomato = document.getElementById("tomato");
vPotato = document.getElementById("potato");
vSpaceSuit = document.getElementById("spacesuit");
}

addEvent(vTomato, "click", GetTomato);
addEvent(vPotato, "click", GetPotato);
addEvent(vSpaceSuit, "click", GetSpaceSuit);

var vOutput = document.getElementById('output');

function setText(ele, text)
{
/* if (ele.firstChild != null)
{
ele.firstChild.nodeValue = text;
}
else
{
ele.appendChild(document.createTextNode(text));
}
*/
ele.innerHTML = text;
}

function GetTomato(ev)
{
Default.GetTomato(GetTomato_Callback)
}

function GetTomato_Callback(response)
{
setText(vOutput, response.value);
}

function GetPotato(ev)
{
Default.GetPotato(GetPotato_Callback)
}

function GetPotato_Callback(response)
{
setText(vOutput, response.value);
}

function GetSpaceSuit(ev)
{
Default.GetSpaceSuit(GetSpaceSuit_Callback)
}

function GetSpaceSuit_Callback(response)
{
setText(vOutput, response.value);
}

[Submit Comment]Home