call partial by jquery

Hi Guys,

Sb could help me in this problem?

I have an partial that I pass some parameters…

I need to create many partials by click event of a link, How can I do that?

I tried to do like this way
But it does’nt work…

$("#addContactLink").bind(“click”,

	function(){

		$("#partialtestdiv").append("<%=render :partial=>'shared/user_contacts',:locals=>{:f=>f},:object=>resource.user_contacts %>");

	}

);

Hi Guys,
Sb could help me in this problem?
I have an partial that I pass some parameters...
I need to create many partials by click event of a link, How can I do that?

I tried to do like this way
But it does'nt work...

Do you get an error, or just no text in partialtestdiv?

No errors appears just a pure html is inserted in div:

<%=render :partial=>‘shared/user_contacts’,:locals=>{:f=>f},:object=>resource.user_contacts %>

the html is similar of the inserted partial in div

HI Bruno,

Hmmmm…

Ok, I will try do this using an ajax call…

But How can I pass object references using an ajax call? Is it possible in rails or I need pass object attributes by JSON?
Thx :smiley:

I believe that's what the 'data' argument of the .load function is
supposed to be used for. Make a simple test using a string and see
what you get in the params hash on the server.

Best regards,
Bill

If you're not already using them, I find both the Firebug and Live
HTTP Headers plug-ins indispensable for exploring ajax calls.

Bill

Ok!!
I will take a look better in these parameters.

I’m using default chrome developers js debug. Is Firebug better?

thx for the help ;D

I do all my dev work in Firefox because of the tools. I hear Chrome
is catching up but don't have any experience there yet.

Bill