Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: trigger the url without visiting it

trigger the url without visiting it 1 Jahr 5 Monate her #93568

  • agabriel
  • agabriels Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
Hi,

I have a survey that need to tract if they click the Facebook share button in the completed page.
- I used a url to solve this. But the problem is the user is navigating away from the completed page when they click the share button.

How can i trigger the url without visiting it?

I tried with ajax but its not working

Here's my example code:
function shared(){
//NOT WORKING
$.ajax({
type: "POST",
url: "http://domainname/surveys/index.php?sid=XXXXXXlang=en&000000X0000X0000=yes", //used to record that they clicked the share button
success: function(data){
alert("thank you for sharing");
}
});
 
}
Der Administrator hat öffentliche Schreibrechte deaktiviert.

trigger the url without visiting it 1 Jahr 5 Monate her #93582

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6276
  • Dank erhalten: 801
  • Karma: 240
Hello,

There are 2 solution:
- Use your own script in completed page with something like;
example.org/thanks.php?srid={SAVEDID}
This script update the lime_survey_XXXX datatable, line srid.
- Do this before completed, at the last page: clicking shared check "Yes" to a yes/no question

Denis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

trigger the url without visiting it 1 Jahr 5 Monate her #93587

  • Ben_V
  • Ben_Vs Avatar
  • OFFLINE
  • Platinum Lime
  • Beiträge: 1068
  • Dank erhalten: 235
  • Karma: 74
Hi,

If you want to store if a respondant was sharing or not, Denis's solution looks good.

If you also want to simply track how many times respondants were clicking on your share button and retrieve the survey ID (and maybe more infos) you should have a look here
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Der Administrator hat öffentliche Schreibrechte deaktiviert.

trigger the url without visiting it 1 Jahr 5 Monate her #93650

  • agabriel
  • agabriels Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
Hi Denis,

Sorry but i cant do that, the script must run and update the datatable if they click the FB share button in the completed page without navigating away in that same page.

To be exact i place the code in 'assessment.pstpl' because i wanted to share their assessment score in facebook and tracking the click in that button.

Cheers
Ali
Der Administrator hat öffentliche Schreibrechte deaktiviert.

trigger the url without visiting it 1 Jahr 5 Monate her #93651

  • agabriel
  • agabriels Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
Hi Ben,

Thank you for your reply.

But my problem is triggering this link http://domainname/surveys/index.php?sid=XXXXXXlang=en&000000X0000X0000=yes // to update my datatable without navigating away from that page or visiting that link.

Ali
Der Administrator hat öffentliche Schreibrechte deaktiviert.

trigger the url without visiting it 1 Jahr 5 Monate her #93667

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6276
  • Dank erhalten: 801
  • Karma: 240
agabriel schrieb:
But my problem is triggering this link http://domainname/surveys/index.php?sid=XXXXXXlang=en&000000X0000X0000=yes // to update my datatable without navigating away from that page or visiting that link.
Then you need to doing it with an ajax call.

Don't use LS to update DB, a clean php file receving {SAVEDID} is better i think.
jQuery.ajax({
  type: 'GET',
  url: 'http://www.example.com/yourscript.php',
  data: {
    srid: '{SAVEDID}'
  }
});

yourscript just update answers in the survey table of the database srid is the "Textes complets id" of the line.
You can control if $_SESSION is open and is the srid is OK before updating it.

Denis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

trigger the url without visiting it 1 Jahr 5 Monate her #94070

  • agabriel
  • agabriels Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 9
  • Karma: 0
DenisChenu schrieb:
yourscript just update answers in the survey table of the database srid is the "Textes complets id" of the line.
You can control if $_SESSION is open and is the srid is OK before updating it.

Denis

Hi Denis,

i dont have any idea what to place yourscript.php to update the srid database

can you please give me a sudo code that i will place in the yourscript.php so it can update the database?
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.145 Sekunden
Donation Image