views:

30

answers:

1

Need assistance please. (More confused than anything really)

I've got ASP.NET mvc controller

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Dashboard(string Whatever)
    {
        //Save name to database
        System.IO.StreamWriter swLogFile = new StreamWriter(@"c:\temp\test.txt", true);
        swLogFile.WriteLine(Convert.ToString(DateTime.Now) + ":" + Convert.ToString(DateTime.Now.Millisecond) + " - " + Whatever);
        swLogFile.Close();

        return Content("success");
    }

Simply i want to capture what is passed from (string Whatever) when data is passed via prototype on my view form.

new Ajax.Request(this.options.saveurl,
    {method:'post', Whatever:"Scott", onComplete:function(t) 
    {$('data').update(t.responseText + $('data').innerHTML);
    } });

However when this executes the 'Whatever' is always null. Am i missing something. If i use jQuery i get no problems. (my jQuery example).

jQuery.noConflict();
jQuery.post("/Home/Dashboard/Dashboardsave", { Whatever: "Scotta" }, function(data) { alert(data); });

Can anyone see what i'm doing wrong here?

Scotty

A: 

You could use the parameters property:

new Ajax.Request(this.options.saveurl, {
    method: 'post', 
    parameters: { Whatever: 'Scott' },
    onComplete: function(t) {
        $('data').update(t.responseText + $('data').innerHTML);
    } 
});
Darin Dimitrov
@Darin ~ How stupid do i feel! Excellent! Thanks Darin
Scott