V
V
Vyacheslav Yashnikov2016-04-10 11:18:15
PHP
Vyacheslav Yashnikov, 2016-04-10 11:18:15

How to use javascript object values ​​in php?

Good afternoon.
I have an object
order = {
price : this.cart.totalPrice(),
emailOrdersTo : this.emailOrdersTo,
site : window.location.host,
currency : this.currency,
language : this.language
}
I pass it to the server using the post method :
server.post(this.baseUrl + '/form/storeformprocessor.php', order, bind(function(err){
if(err){
var message = ''
+ escapeHtml(t('orderFailed')) + ''
this.cartPopupView.show(message)
}
}, this))
how to use the values ​​of the order object in the storeformprocessor.php file, for example, display the site or price value in an email?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2016-04-10
@sergiks

Try like this:

$data = json_decode( $_POST['data']);
$data->price; // 6230
$data->name; // 1111

D
Denis Safronov, 2016-04-10
@mcdb

Start with var_dump($_POST); in PHP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question