I'm trying to pass a parameter coming from my controller to a javascript script so I can edit the data. But the javascript isn’t accepting my parameter.
Here is the code:
@for(status <- lista){
<tr>
<td>@status.getDescricao()</td>
<td><a href="javascript:;" onclick="enviar('formAltStatus/@status.getCodStatus()')"><img src="@routes.Assets.at("img/edit.png")" alt="" title="Editar"/></a>
<a href="@routes.StatusController.removerStatus(status.getCodStatus())"><img src="@routes.Assets.at("img/erase.png")" alt="" title="Remover"/></a>
</td>
</tr>
}
The @status.getCodStatus() is my ID.
The route:
GET /formAltStatus/:id controllers.StatusController.formAltStatus(id:Long)
The javascript:
function enviar(a){
$.ajax({
url: "/"+a,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: "html",
async:true,
success: function(html){
$("#nova").html("");
$("#nova").html(html);
$("#logo").show();
}
});
}
Is there another way to do this?