Welcome Guest, Not a member yet? Register   Sign In
Event handling
#3

(This post was last modified: 06-03-2020, 10:22 AM by jreklund.)

(05-26-2020, 03:48 AM)InsiteFX Wrote:
PHP Code:
url:"<?php echo base_url('controller/method');?>"
Hello Sir,

No, it is not working. i used the concept in html page, it is working fine. Is it something related to reloading or refreshing of form in CI?
CI view page is like this 
PHP Code:
<body> 
<div id="main"> 
<div id="submain">
<
a href="logout" style="float:right;color:darkblue;"Logout</a>
<
h1>Flight Details</h1>
<
hr/>
<?
php if(isset($error_message)){?>
      <div class="error_msg">
            <?php echo $error_message?>
      </div>
    <?php }

echo 
form_open('flights_cont/view_flight_details', array( 'id' => 'myform'));?>

<label>From City :</label>
<input type="text" name="txtFrCity" id="idFrCity" placeholder="Departure From"><br>
<?php echo form_error('txtFrCity''<div class="error_msg">',
'</div>'); ?><br>
<label>To City :</label>
<input type="text" name="txtToCity" id="idToCity" placeholder="Arrival To"><br>
<?php echo form_error('txtToCity''<div class="error_msg">',
'</div>'); ?><br />
<label>Slot :</label>
<select name="slot">
<option value="04:00:00 To 06:59:59">
Early Morning</option>
<option value="07:00:00 To 11:59:00">Morning</option>
<option value="12:00:00  To 15:59:00">Afternoon</option>
<option value="16:00:00 To 19:59:00">Evening</option>
<option value="20:00:00 To 23:59:00">Night</option>
<option value="24:00:00 AM To 03:59:00">Late Night</option>
</select> <br>
<br>
<input type="submit" value="Check" name="check"><br>


</div> 
<!--<div id="submain2"> -->
<?php 
if (isset($_POST['check'])) 
{?>
<div id="submain2">
<?php 
foreach($info->result() as $row) : { ?>

<p><?php echo $row->flight_number?></p>
<table border="" rules="all">
<tr>
<th>From City</th>
<th>To City</th>
<th>Departure</th>
<th>Arrival</th>
<th>Price</th>
<th>Stopage</th>
<th>Book Ticket</th>
</tr>

<tr>
<td> <?php echo $row->from_city?> </td>
<td> <?php echo $row->to_city?> </td>
<td> <?php echo $row->departure_time?> </td>
<td> <?php echo $row->arrival_time?> </td>
<td> <?php echo $row->price?> </td>
<td> <?php echo $row->stopage?> </td>
<td><a href="booking_form"> Book </a></td>
</tr>
</table>

<?php 
} endforeach;?>
</div>
<?php }
?>
<!--</div>-->
</div>
<script type="text/javascript">

        $(function()
        {

$('#myform').submit(function(e)
    {
    // e.preventDefault();
    var dataString = $("#myform").serialize();
    $.ajax
    ({
        type:"POST",
        url:"<?php echo 'flights_cont/view_flight_details'?>",
        data: dataString
        });  
            $( "#submain" ).css({
"marginLeft": "-10px",
});
            });
      
    });


</script>
</body>
</html> 
Reply


Messages In This Thread
Event handling - by PA1207 - 05-25-2020, 05:36 AM
RE: Event handling - by InsiteFX - 05-26-2020, 03:48 AM
RE: Event handling - by PA1207 - 06-02-2020, 11:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB