Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

using prototype with asp.net

  • 04-04-2007 09:37PM
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    I have heard great things about prototype so im trying to use it with a basic asp.net page:
    [B]HTML[/B]
    <a href="javascript:doAjax()">Link</a>
    
    [B]JS[/B]
    
    function doAjax(){
     new Ajax.Request('default.aspx?id=1', {   method: 'get',   parameters: {}   }); 
    }
    

    I thought the above would call default.aspx?id=1 and do what i want it to do when this url is requested but nothing is happening.

    Any ideas what im doing wrong ?

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Can you post the code behind for default.aspx?


  • Registered Users, Registered Users 2 Posts: 872 ✭✭✭grahamor


    it's just

    page_load
    {

    if(!IsPostBack)
    {
    //do stuff
    }

    if(Request["id"] == "1")
    {
    Response.Write("Ajax Called"); // this is meant to write out when the ajax.request is called in the javascript.
    }

    }

    i know i'm missing something very simple, i just dont know what it is...


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    HTML
    <a href="javascript:doAjax()">Link</a>

    JS

    function doAjax(){
    new Ajax.Request('http://www.yourserver.com/default.aspx?id=1', { method: 'get', parameters: {} });
    }

    I don't have time to really look at it but I'd hazard a guess and say that the default.aspx url isn't fully qualified. It is in the code above, try that.


Advertisement