Page 1 of 2

organise an array

Posted: Mon Nov 11, 2013 1:47 pm
by Michael4771079

Hi,
I have an array which I am sending with sendgrid, all works well, but my array is not very user friendly,

Is there something that can be done with the array before its sent with sendgrid.

Remove brackets and quotes?

but more importantly a line break at the mark on the screenshot below

thx

Image

Image


organise an array

Posted: Mon Nov 11, 2013 2:21 pm
by Kateryna Grynko

Hi Michael,

Please give us a public link, this should be working.


organise an array

Posted: Mon Nov 11, 2013 2:38 pm
by Michael4771079

Hi Katya,
here is the link Login and pass "a" the app is shared "star pizza"
to send email click checkout from vegetarian pizza screen and click order button at bottom to send email, you will need to add an email address in the input

this is the code for the email content I have used below

cheers

http://appery.io/app/mobile-frame?src...

Image


organise an array

Posted: Mon Nov 11, 2013 3:53 pm
by Kateryna Grynko

Michael,

If you need to display an array in a usual view then you can process it as you want. For example display parameter 'Base' in console (then you can do what you need):precodevar arr = JSON.parse(liveorderArray);
$(arr).each(function(e){
console.log("Base = " + arr[e].Base + "\n");
});/code/pre


organise an array

Posted: Mon Nov 11, 2013 4:52 pm
by Michael4771079

Katya,
sorry I dont follow, where do I use this code?


organise an array

Posted: Tue Nov 12, 2013 8:16 am
by Kateryna Grynko

Hi Michael,

You should paste it instead:prevar liveorderArray = localStorage.getItem("liveorderArray") + "\n";/pre
codeconsole.log()/codewas only an example. You can output data as you want. If there are any difficulties you can send us a text you want to get as a result.


organise an array

Posted: Tue Nov 12, 2013 12:13 pm
by Michael4771079

Hi Katya,
from the array I would like it to appear in the email like the example below

"[{"Pizza":"Margarita","Size":"Twelve Inch Stuffed Crust","Base":"Deep Base","Price":"6.50"},{"Pizza":"Hot Vegetarian","Size":"Twelve Inch","Base":"Deep Base","Price":"6.00"}]"

example

Pizza : Margarita , Size : Twelve Inch Stuffed Crust , Base : Deep Base , Price :6.50 Pizza : Hot Vegetarian , Size : Twelve Inch , Base : Deep Base , Price : 6.00


organise an array

Posted: Tue Nov 12, 2013 2:30 pm
by Kateryna Grynko

Michael,

Would you like it to appear this way?prevar liveorderArray = localStorage.getItem("liveorderArray");
liveorderArray .replace(/[[]{}]/gi,"").replace(/"/gi," ").replace(/ ,/gi,",");/pre


organise an array

Posted: Tue Nov 12, 2013 2:54 pm
by Michael4771079

Hi Katya,
this is how it appears in my email, and this is the code implemented

Image

Image

I am trying to get it to appear like this

Pizza : Margarita , Size : Twelve Inch Stuffed Crust , Base : Deep Base , Price :6.50 Pizza : Hot Vegetarian , Size : Twelve Inch , Base : Deep Base , Price : 6.00


organise an array

Posted: Tue Nov 12, 2013 3:46 pm
by Kateryna Grynko

Sorry, there was a typo, please replacepreliveorderArray .replace/prewithpreliveorderArray.replace/pre