views:

26

answers:

2

I have this

    <a href="#" id="preview_button"></a>

And I want the link to be replaced with an actual link.

So i figured I use this

    page.replace_html("preview_button","<a href='/preview/#{@object.name.to_url}' class='preview' onclick='window.open(this.href);return false;'>Preview</a>")

but when I use the inspecter with chrome, it tell me

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

so... ideas?

A: 

The problem there is not your javascript replacing function. That seams to be all right.

You must inspect the link BEFORE you click the link but after the function was called, so you can see if it is being generated right.

The 500 error means that the request reached your rails controller but something wasn't right inside that.

robertokl
A: 

you should look at error logs, to see what generated error 500

apeacox