Page 1 of 2

How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Tue Nov 19, 2013 6:11 pm
by Matthias Sieber

I'm building a simple app that takes an Email address and gets JSON information back related to that Email via REST Service. Names, Jobtitle, Social Media Profiles, Location etc. Image

According to the tests on my iOS devices, the responses are mapped correctly to the fields. It may happen though, that the person is not signed-up for all queried social media networks, thus resulting in an empty string for that field (I had it returned null previously, with the same result).

Since the links have to have a default href in the UI designer, I let them have http://appery.io.

After entering an email address and invoking the rest service with the click of the search button, the fields get populated by the json response. Now I want to only display valid links; links that have not an empty string as its href or http://appery.io as its href. And here I run into problems, because even though the href appears to be what it's been set to by invoking the rest service, no links will show, when I run this javascript after invoking the service.

if ($('#facebook_link').attr('href') != 'http://appery.io') {
$('#facebook_link').show();
}
if ($('#twitter_link').attr('href') != 'http://appery.io') {
$('#twitter_link').show();
}
if ($('#linkedin_link').attr('href') != 'http://appery.io') {
$('#linkedin_link').show();
}
if ($('#google_link').attr('href') != 'http://appery.io') {
$('#google_link').show();
}


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Tue Nov 19, 2013 7:13 pm
by Kateryna Grynko

Dear Matthias,

You should replace:pre$('#google_link')/pre
with:preAppery("google_link")/pre


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Tue Nov 19, 2013 10:12 pm
by Matthias Sieber

The result, not surprisingly, is the same.


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 4:04 am
by Matthias Sieber

I can't give a star for this answer, because the result is the same. I'm still having the same problem, thus this topic shouldn't be marked as answered.


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 4:10 am
by Alena Prykhodko

Sorry Matthias, research needs more time, we'll update asap.


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 7:07 am
by Maryna Brodina

Hello! As you have all links ended with link you can use it in jQuery selector. On service success event run the following code:
pre$("[dsid$=link]", $.mobile.activePage).not("[href='http://appery.io']").show();/pre


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 7:13 pm
by Matthias Sieber

Thank you for this reply. It makes absolute sense, but now I'll get only the Facebook link back.


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 8:11 pm
by Kateryna Grynko

Hi Matthias,

Try the following:pre$("[data-role=appery_link]").not("[href='http://appery.io']").show();/pre


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 8:21 pm
by Matthias Sieber

same result


How do I fix this problem with links that are manipulated by a restservice's response?

Posted: Wed Nov 20, 2013 8:30 pm
by Matthias Sieber

It appears that my mobile device isn't loading the most recent version through the appery app. It has the correct date, but visible changes are not loaded. Closing the app on my iPhone and restarting the app has no effect. And I can't test the app in my browser anyway.