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 :

    <form id="form1" runat="server">
    <div>
        <button id="potato">potato</button>&nbsp;
        <button id="tomato">tomato</button>&nbsp;
        <button id="spacesuit">spacesuit</button>&nbsp;

        <br />
        <div id="output"></div>

        <script language="javascript" src="Default.js"></script>
        <br />
        <asp:Button ID="btnRefresh" runat=server Text="full refresh" />

    </div>
    </form>

This is in my .aspx.cs :

[AjaxPro.AjaxNamespace("Default")]
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(Default));
    }

    [AjaxPro.AjaxMethod]
    public string GetTomato()
    {
        return "You are eating a tomato!";
    }

    [AjaxPro.AjaxMethod]
    public string GetPotato()
    {
        return "You are eating a potato!";
    }

    [AjaxPro.AjaxMethod]
    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.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to