too long

An easy one I can't find the answer to

Would this be the right way to do it?

Jquery/Javascript

var result = result.text;
var users = localStorage.getItem('user');

$.ajax({
       url:'******',
       method: 'POST',
       data: {user: users, serial: result},
       dataType: "text",
       contentType: "application/json",
       success: function(data){

PHP- :

$u1 = ($_POST['user']);
$duid = ($_POST['serial']);