Hello,
I have a div, and content of this div is updating on every ajax request. The problem is when I'm using IE , I'm losing all input values.
For example:
1) I have no content in the div.
2) I'm getting the content using ajax request.
3) I have a <input type="hidden" name="hotels_id" value="2">
after that request.
4) I'm posting this input name and value, again using ajax request.
5) in IE: There is no hotels_id -- in FF and Chrome: That Works!
By the way, I'm using http://en.dklab.ru/lib/JsHttpRequest/ "JsHttpRequest" Library for ajax.
Thanks for your answers.
Some lines from my script.
//get_content.php
if ( (tep_not_null($preview)) && ($errors == '') ) {
switch ($preview) {
case 'availablity':
case 'types':
$rt_id = tep_db_prepare_input($HTTP_POST_VARS['id']);
if ( isset($rt_id) && tep_not_null($rt_id) && is_numeric($rt_id) ) { //0 disindaki rakamlar
$hotel_to_rooms_query = tep_db_query("select hotel_id, rt_id, status from " . TABLE_ROOMS_TYPES . " where hotel_id = '" . (int)$check_hotel_id['hotels_id'] . "' and rt_id = '" . $rt_id . "' and status = '1'");
$hotel_to_rooms = tep_db_num_rows($hotel_to_rooms_query);
if ($hotel_to_rooms == 1) {
if ($HTTP_POST_VARS['preview'] == 'availablity') {
//require(DIR_WS_HOTEL . 'demo2.php');
} else if ($HTTP_POST_VARS['preview'] == 'types') {
require(DIR_WS_HOTEL . 'room_type.php');
}
} else {
$errors .= "Please check your room type!";
}
} else {
$errors .= "Please check your room type 2!";
}
//JavaScript
function rooms_info(room_id, action) {
document.getElementById('content').innerHTML = '<li> loading </li>';
// Create new JsHttpRequest object.
var reqRoomsInfo = new JsHttpRequest();
// Code automatically called on load finishing.
reqRoomsInfo.onreadystatechange = function() {
if (reqRoomsInfo.readyState == 4) {
document.getElementById('content').innerHTML = reqRoomsInfo.responseText;
}
}
// Prepare request object (automatically choose GET or POST).
reqRoomsInfo.open(null, 'get_content.php', true);
// Send data to backend.
if ( action == 'availablity' ) {
reqRoomsInfo.send( { id: room_id , load: 'availablity' } );
} else if ( action == 'types' ) {
reqRoomsInfo.send( { id: room_id , load: 'types' } );
}
}