[jQuery] Re: ajax post to ruby script

2008-09-25 Thread BB

I can't see any problems with that script.
What do you think is wrong with it?


On 25 Sep., 06:02, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hello!
>
> Sorry for the n00b post, but i've come to a dead end. I'm trying to
> write an ajax callback to a Ruby script that does a simple database
> update. I'm having trouble with the syntax I think. Here's what I've
> been trying:
>
>         $("#jLink").click(function() {
>
>                         $.ajax({
>                                 type: "POST",
>                                 url: "testing.rb",
>                                 data: "name=ryan",
>                                 success: function(msg){
>                                     alert( "Data Saved: " + msg );
>                                 }
>                         });
>          });
>
> Does anyone have any examples I can take a look at?
>
> Thanks!


[jQuery] Re: ajax post to ruby script

2008-09-25 Thread [EMAIL PROTECTED]

The alert just shows the contents of the Ruby script. I've updated the
script to be just:

  #!/usr/local/bin/ruby

  unless ARGV.length > 0
puts "you must provide a valid value"
exit
  end

  return ARGV[0]


but that is all that is returned. It returns the script contents
instead of the ARGV[0].

Maybe I need to post this in a Ruby forum since that's where my
n00bness lies?

On Sep 25, 6:30 am, BB <[EMAIL PROTECTED]> wrote:
> I can't see any problems with that script.
> What do you think is wrong with it?
>
> On 25 Sep., 06:02, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hello!
>
> > Sorry for the n00b post, but i've come to a dead end. I'm trying to
> > write an ajax callback to a Ruby script that does a simple database
> > update. I'm having trouble with the syntax I think. Here's what I've
> > been trying:
>
> >         $("#jLink").click(function() {
>
> >                         $.ajax({
> >                                 type: "POST",
> >                                 url: "testing.rb",
> >                                 data: "name=ryan",
> >                                 success: function(msg){
> >                                     alert( "Data Saved: " + msg );
> >                                 }
> >                         });
> >          });
>
> > Does anyone have any examples I can take a look at?
>
> > Thanks!