Welcome Guest, Not a member yet? Register   Sign In
Problem with load->view and jquery
#1

[eluser]vitao1718[/eluser]
guys im trying to do sommenting like this in my ajax code :

CONTROLLER:
Code:
$form = $this->load->view('cliente/form', $data, true);
     $data['form'] = $form;

VIEW:
Code:
[removed]
    $(document).ready(function(){
        $('#formulario').replaceWith("<?php echo $form; ?>");
    });
[removed]


i'm having trouble with that cause the 'echo' is printing the code with line breaks, i just need sommeting to print the $form variable as a string with no format and then i have no errors on javascript.
if i put my view form entire in php with echo it works great, e.g:

Code:
<?php
$data['form_cliente'] = $cliente;

$retorno  = "";
$retorno .= "<tr id='cliente_$cliente->id'>";
$retorno .= "<div>";
$retorno .= "    <td>$cliente->nome</td>";
$retorno .= "    <td>$cliente->id_usuario </td>";
$retorno .= "    <td>$cliente->id_endereco </td>";
$retorno .= "    <td>$cliente->id_endereco </td>";
$retorno .= "    <td>$cliente->id_endereco </td>";
$retorno .= "    <td>";
if (isset($cliente->id)) {
    $retorno .= "        <a href='[removed]'>id)' >Editar</a>";
    $retorno .= "        <a href='[removed]'>id)' >Apagar</a>";
} else {
    $retorno .= "        <a href='[removed]'>Cancelar</a>";
}
$retorno .= "    </td>";
$retorno .= "</div>";
$retorno .= "</tr>";

echo $retorno;
?&gt;


i'm doing this right?or i have a better way to do that?


Messages In This Thread
Problem with load->view and jquery - by El Forum - 08-10-2010, 12:46 PM
Problem with load->view and jquery - by El Forum - 08-11-2010, 03:53 AM
Problem with load->view and jquery - by El Forum - 08-11-2010, 05:49 AM
Problem with load->view and jquery - by El Forum - 08-11-2010, 06:00 AM
Problem with load->view and jquery - by El Forum - 08-11-2010, 06:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB