Responsive Ad Area

Share This Post

test

updating a multidimensional array stored in session storage

I have taken over a project and am not total familiar with JQuery and session storage. the issue is that after updating the info and clicking update it provides an error, “Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at fillArray (main.js? [sm]:313)
at UpdateProduct (main.js? [sm]:234)
at HTMLButtonElement.onclick ((index):405)".

Included link to github repo:https://github.com/bveasey/Jquery-project

function UpdateProduct() // called on click of an update btn
{

   // capture id from hidden element set in editproduct function
   var productId = $('#txtHiddenId').val();
   console.log("***** line:233 *****n product id =" + productId);
   fillArray(productId);
   console.log("***** line:235 *****n Fill array called!");
   BindTable();
   console.log("***** line:237 *****n Bind Table called!");
}

// other functions 
function fillArray(prodid)
{
  console.log("***** line:310 *****n  Begin Fill Array");

  // find the item in the product array and update it
  $.each(JSON.parse(sessionStorage.setItem('products', 
  JSON.stringify(productArray))), function (idx, v) 
{
  console.log("***** line:315 *****n " + product.id);
  // Check if current prodid is the id wanted
  if (product.id === prodid) 
  {// ids match
    console.log("***** line:319 *****n product is's match");

    // populate data
    product.id = productId;
    product.arrivalDate = $('#modalRequestedArrivalDate').val();
    product.productCode = $('#modalProductCode').val();
    product.description = $('#modalDescription').val();
    product.quantity = $('#modalQuantity').val();
    product.quantityType = $('#modalQuantityType').val();
    product.plant = $('#modalPlant').val();
    product.shippingMethod = $('#modalShippingMethod').val();
    product.specialInstructions = $('#modalSpecialInstructions').val();

    console.log("***** line:310 *****n  END Fill Array");
  }
});

}
// bind table just updates the table.


updating a multidimensional array stored in session storage
updating a multidimensional array stored in session storage
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>