Using Sendgrid in a list

This forum contains topics that were moved from Get Satisfaction
Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

Post by Mike6979865 »

Hello,
I have a multiple items that display in a list. For example, I see name, address, email, and problem... I want to click on a button and have that data including the picture forwarded to a specific email that I have listed in a drop down list. Here's what I did, and I hope you'll be be to assist me.

var res = "";
var data = {
Name: Appery('Name')[0].value ? Appery('Name')[0].value : "",
Email: Appery('Email')[0].value ? Appery('Email')[0].value : "",
Image: localStorage.getItem('picture') ? "Image": ""
};

for (ii in data){
if (data[ii] !== ''){
res += "span" + ii + "/span : span " + data[ii] + "/span";
}
}
res += "";

localStorage.setItem('email',res);

This code works fine when there is no list. The button is included with the list. But, it looks like that when I use Appery('Name')... with the list, it doesn't read the value that is displayed in the list. Is that right? Ofcourse I mapped email to html in sendgrid and so forth.. But it doesn't seem to work. Can I access the fields in the list using Appery('..') as specified in the code above?

Regards,

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using Sendgrid in a list

Post by Evgene Karachevtsev »

Hello Mike,

Could you please provide us with public link to your project and steps to reproduce the issue?

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

Post by Mike6979865 »

Hi Evgene,

I'll email you the credentials to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using Sendgrid in a list

Post by Evgene Karachevtsev »

Mike,

when I go into the category "view tickets by date" I don't see the button "REFER TO AGENCY", could you please check this?

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

Post by Mike6979865 »

Yes, the button should be in the list. Here's a screenschot

Select the Date 10/15/2014
Click View Tickets By Date
Then it will open another page
scroll down and you'll see this button "REFER TO AGENCY"

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using Sendgrid in a list

Post by Evgene Karachevtsev »

Mike,

Please repeat the screenshot. And this is the screenshot of what we get
Image

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

Post by Mike6979865 »

Hi,

You are doing 10/16/2014. You should select 10/15/2014.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Using Sendgrid in a list

Post by Kateryna Grynko »

Hi Mike,

When I click "REFER TO AGENCY" I get Cross-site HTTP request error:

preXMLHttpRequest cannot load ... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://appery.io' is therefore not allowed access./pre

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Using Sendgrid in a list

Post by Mike6979865 »

Per your response, here's what I should do.

1) You shouldn't add the html and body tags in res
2) The method of mail service must be Post instead of Get
3) If you do not make a hybrid application but html app, for the the mail servers you should use the Appery.io proxy

I changed the method, and added a proxy. What adjustments should I make to this code below? Thank you so much for your assistance.

var res = "";
var data = {
Name: Appery('name')[0].value ? Appery('name')[0].value : "",
Email: Appery('email')[0].value ? Appery('email')[0].value : ""
};
for (ii in data){
if (data[ii] !== ''){
res += "span" + ii + "/span : span " + data[ii] + "/span";
}
}
res += "";
localStorage.setItem('email',res);

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Using Sendgrid in a list

Post by Kateryna Grynko »

Hi Mike,

First, get current list item and save the link to the element in the 'listItem' variable, and then search for 'name' and 'email' labels inside current list item rather than inside the whole page.

Your fixed code: precodevar res = "<html><body>",
listItem = $(this)&#46;closest('[name="mobilelistitem_25"]'),
name = $('[name="name"]', listItem )&#46;text(),
email = $('[name="email"]', listItem )&#46;text(),
data = {
Name: name ? name : "",
Email: email ? email : "",
},
ii;

for (ii in data){
if (data[ii] !== ''){
res += "<div><span>" + ii + "</span> : <span> " + data[ii] + "</span><>&quot
}
}
res += "</html></body>&quot

localStorage&#46;setItem('email',res);/code/pre

Post Reply