* Maninder, Singh <[EMAIL PROTECTED]> [2005-10-27 02:46]:
> Hi, I am trying to play with all the methods in the Array Object.
> 
> Just wanted to check with you guys if this is the correct explanation of 
> toQueryParams().
> If yes, then I'll add it to the documentation as well.
> 
> Works for me (but I am not sure if it's the correct way to use it).
> 
>   /* String.prototype.toQueryParams takes a query string, i.e, string with
>      name value pairs separated with '&', splits them up and returns an object
>      using whose properties we can get the values of the params */
>   /* Usage: 
>               var queryString = "?name=mandy&[EMAIL PROTECTED]&age=20";
>               name = queryString.toQueryParams().name;
>               email= queryString.toQueryParams().email;
>               age  = queryString.toQueryParams().age;
>               alert(name+" "+email+" "+age);
>   */    

    Since the query string is calcluated, I think a better usage
    would be:

    var str = "?name=mandy&[EMAIL PROTECTED]&age=20"
    var qs = str.toQuerySTring();
    alert(qs.name + " " + qs.email + " " + qs.ag);

--
Alan Gutierrez - [EMAIL PROTECTED] - http://engrm.com/blogometer/

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to