load a view in a div jquery |
[eluser]BlueDom[/eluser]
Hello big part of my application is designed with ajax I am now trying to load a view in a div using ajax jQuery works But I have no idea how to do this Someone could help me?
[eluser]BlueDom[/eluser]
No response to this? please I searched google and find nothing
[eluser]danmontgomery[/eluser]
Something like Code: $.get('path/to/somewhere', function(data) { $('#my_div').html(data); }); or Code: $.post('path/to/somewhere', { var_1: 'some_value', var_2: 'some_other_value' }, function(data) { $('#my_div').html(data); }); Where path/to/somewhere would be the path to a controller function which echoes the view. http://api.jquery.com/jQuery.get/ http://api.jquery.com/jQuery.post/
[eluser]BlueDom[/eluser]
Ok thanks But the question now is how the driver must go now I have it in this way, but does not work the view Code: function sendForm(url,div) { Then controller Code: function form(){
[eluser]danmontgomery[/eluser]
What's the point of running json_encode on a string? All that does is wrap the string in quotes... What's in the listados view? What does "does not work mean"? Are you getting javascript errors? If so, what are they? Details, please
[eluser]BlueDom[/eluser]
Ok thanks I solved but I can not send the form to interpret json $ This-> load-> view (); Finally finished with this. the View Code: function sendForm(url,div) { The controller Code: function form(){
[eluser]Phil Sturgeon[/eluser]
That's the long way to do it. Code: $("#Rasult").load('/report/form', $("#Formulario").serialize() ); Much nicer :-) |
Welcome Guest, Not a member yet? Register Sign In |