Matthias Sieber
Posts: 0
Joined: Tue Nov 19, 2013 6:11 pm

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

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();
}

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

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

Dear Matthias,

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

Matthias Sieber
Posts: 0
Joined: Tue Nov 19, 2013 6:11 pm

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

The result, not surprisingly, is the same.

Matthias Sieber
Posts: 0
Joined: Tue Nov 19, 2013 6:11 pm

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

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.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

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

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

Matthias Sieber
Posts: 0
Joined: Tue Nov 19, 2013 6:11 pm

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

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

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

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

Hi Matthias,

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

Matthias Sieber
Posts: 0
Joined: Tue Nov 19, 2013 6:11 pm

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

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.

Return to “Issues”