Dear Dogen,
Rather then using the link_to_remote use remote_function
(http://pylonshq.com/docs/module-webhelpers.rails.prototype.html#remote_function)
I think that will do what you want it to do. However you may run into
the same problem that I had when I did exactly the same thing your doing
(linking to a remote function from javascript) which was I was unable to
pass data from the javascript to the remote_function so I actually took
the text that was generated by the remote_function and simply inserted
that into my javascript. So in my javascript I added this:
new Ajax.Request('<% url_for(action='do_something', var='');
%>'+someJavascriptVariable, {asynchronous:true, evalScripts:true})
Jose
Dogen wrote:
> Hello Jose,
> Thank you for comments. It helps to examine the problem differently. I
> guess my main porblem is passing data from JS to controller.
> Here is rating.myt source - should handle all AJAX stuf. On "onclick"
> event rating value should be passed to controller function
> (discuss_material.rate_material()). Where I should add link_to_remote,
> or maybe it should be something else?
>
> <script type="text/javascript">
> function submitRating(evt)
> {
> var tmp = evt.target.getAttribute('id').substr(5);
> var widgetId = tmp.substr(0, tmp.indexOf('_'));
> var starNbr = tmp.substr(tmp.indexOf('_')+1);
>
> <% link_to_remote(???); %>
> }
>
>
> function jqueryInit()
> {
> init_rating();
> $('div.rating/img').bind('click', submitRating);
> }
>
> $(document).ready(jqueryInit);
> </script>
>
> <div id="contentwrapper">
> <div class = "rating" id = "rating_1"><% c.rating %></div>
> </div>
>
> Thank you for help
> Samuel
>
>
>
> On Jul 11, 7:37 am, Jose Galvez <[EMAIL PROTECTED]> wrote:
>
>> Dear Samuel,
>> You are going to have to give us more info. I use link_to_remote all
>> the time without any difficulty, so its hard to pin down where your
>> problem is. What are you expecting to happen? link_to_remote doesn't
>> send anything back to the browser without an "update", is the update not
>> happening or is the data not being entered into the database? How do
>> you connect to your database ORM or regular sql, also which database are
>> you using? lots of stuff can go wrong so again more info would be needed
>> before anyone could give advice
>> jose
>>
>>
>>
>> Dogen wrote:
>>
>>> Greeting!
>>> I'd created a reting system using Ajax (kinda "youtube"). My poblem
>>> actually started when i'm trying to pass new rating value, on
>>> "onclick" event, to controller that should save it in DB - just
>>> nothing is happened.
>>> For calling controller I'm using "link_to_remote" . Templating
>>> language is Mighty
>>>
>>> Thank you for help
>>>
>>> Samuel- Hide quoted text -
>>>
>> - Show quoted text -
>>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---