var data = JSON.stringify(localStorage);
$.ajax({
type: 'POST',
url: 'myscript.php',
data: {
'localStorage': data
},
dataType: 'json',
success: function(data, textStatus){
alert(data.my_over_status);
}
})
<?php
$out = new stdClass();
$out->my_over_status = "НЕТ ДАННЫХ!!!";
if(isset($_POST['localStorage']) && !empty($_POST['localStorage'])){
$localStorage = json_decode($_POST['localStorage']);
// Теперь переменная $localStorage это полноценный объект с свойствами
// ajax ждёт ответа и данные должны придти в формате json
header("Content-type:application/json");
$out->my_over_status = "Отлично!!!";
//Завершаем скрипт
die( json_encode($out) );
}
die( json_encode($out) );
?>
var list = document.getElementsByTagName("tr");
arr = [];
list.forEach(function(element, index, array){
var el1 = element.getElementsByClassName("name_eq"),
el2 = element.getElementsByClassName("sn"),
arr.push({
name: el1[0].value,
value: el2[0].value
})
});
var list = document.getElementsByClassName("name_eq"),
arr = [];
list.forEach(function(element, index, array){
arr.push({
name: element.value,
value: element.getAttribute("id")
})
})
var tock = {
'add': function(product_id) {
$.ajax({
url: '',
type: '',
data: '',
dataType: 'json',
success: function(json) {
setTimeout(function(){
$.magnificPopup.open({
items: {
src: '',
},
type: 'ajax'
});
}, 10)
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
},
'remove': function() {
}
}
А вообще - Ростелеком не оч хороший провайдер.
Поэтому, имхо, забить.