I want to return a html by ajax, I have this
$("a[rel^='valora']").click(function(){
var usuario= $(this).data('usuario');
var idea= $(this).data('idea');
$("#valorar").load(
$.ajax({
url: '{{path('valorarIdea')}}',
data: {user: usuario, idea: idea},
type: 'POST',
dataType: 'html'
})
).dialog()
});
I have a this template a div to open de dialog
<div id="valorar" title="Valorar una idea">
</div>
this open de dialog but don´t showme any inside, my html is a template html.twig with a form like this...
<form action="{{ path('valorarIdea') }}" method="post" {{ form_enctype(form) }}>
{{ form_widget(form) }}
</br>
</br>
<input type="submit" />
</form>
if i change this by other thing like this
<p> hello! </p>
don´t work too.
Am I missing something?
thanks.
try this $('<div id="valorar"></div>').load().dialog();
You place ajax call in load call. That is wrong. Take look at this : http://api.jquery.com/load/
.load(url, data, callbackfunction)
EDIT : Example in your case :
$("#valorar").load( '{{path('valorarIdea')}}', data: {user: usuario, idea: idea}).dialog();