Skip to content

Commit

Permalink
keep customer id consistent through a session
Browse files Browse the repository at this point in the history
  • Loading branch information
grant-g committed Feb 16, 2016
1 parent 06c0e5c commit 7944b0c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<script>
var RETRY_INTERVAL = 5000;
var customerId = Math.floor((Math.random() * 999) + 1);
var items = <?php echo $result?>;

function loadItems(items){
Expand Down Expand Up @@ -56,10 +57,8 @@ function addItem(item){
}

function orderItem(itemID){
//create a random customer ID and count
var custID = Math.floor((Math.random() * 999) + 1);
var count = Math.floor((Math.random() * 9999) + 1);
var myjson = {"itemid": itemID, "customerid": custID, "count": count};
var count = Math.floor((Math.random() * 99) + 1);
var myjson = {"itemid": itemID, "customerid": customerId, "count": count};

$.ajax ({
type: "POST",
Expand Down

0 comments on commit 7944b0c

Please sign in to comment.