[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;
?>
i'm doing this right?or i have a better way to do that?