Welcome Guest, Not a member yet? Register   Sign In
I don't undertand this behavior
#1

[eluser]Soporte[/eluser]
Hello,

I appreciate any help. In one view, called "ventas" I have next code

</head>
<body >
[removed]
function mostrarError()
{

if (<?php $modo=isset($modo)?$modo:"1"; echo $modo;?> == 2){
alert("---------------------------------------------------------");
$('#ventana').click();
}
}
[removed]

but, whether modo = 2, never run the following code "$('#ventana').click();"
and in the controller, I have :

public function graba()
{
$ip= $this->input->ip_address();
$datos = explode(",",$_POST['datos']);

list($idart, $canti, $precio) = $datos;
$data['idarti']=$idart;
$data['cant1'] =$canti;
$data['precio']=$precio;
$data['ip'] =$ip;
$result=$this->ventas->graba_modelo($data);

if ($result['huboerror']==false){
redirect("ventas/nuevo");
}else{
$data['title']="------------------";

$data['modo']="2";
$data['menserror']=$result['menserror'];

$this->load->view('ventas/Ventas',$data);
}
}

Many thanks in advance !

#2

[eluser]jonez[/eluser]
Is #ventana in the markup before mostrarError is called? If you view source do you see:
Code:
if (2 == 2) {
#3

[eluser]InsiteFX[/eluser]
Code:
if (<?php $modo=isset($modo)?$modo:“1”; echo $modo;?> == 2){

Do you really think that is going to run? using a Ternary operator inside another if statement.

Code:
<?php
$modo = isset($modo) ? $modo : “1”;

if ($modo == 2){
echo $modo;
}
?>
#4

[eluser]Soporte[/eluser]
[quote author="jonez" date="1392600991"]Is #ventana in the markup before mostrarError is called? If you view source do you see:
Code:
if (2 == 2) {
[/quote]

Hi jonez,

yes, I am using firebug and I can see "if(2==2)", and I attached a picture.

Thank you!

#5

[eluser]Soporte[/eluser]
[quote author="InsiteFX" date="1392642031"]
Code:
if (<?php $modo=isset($modo)?$modo:“1”; echo $modo;?> == 2){

Do you really think that is going to run? using a Ternary operator inside another if statement.

Code:
<?php
$modo = isset($modo) ? $modo : “1”;

if ($modo == 2){
echo $modo;
}
?>
[/quote]

Thank you very much InsiteFX !,
but it does not work, yet.
By some reason that I don't know, this script run at first , but when I load it a second time from my controller, then it does not work.





Theme © iAndrew 2016 - Forum software by © MyBB