Skip to main content
edited tags
Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
edited tags
Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
deleted 220 characters in body; edited tags; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

my first jquery/json Callback for job applicant

This is my first use of jquery and json so would be grateful for any feedback please.

Background - this is on a job listing site and it has a Linkedin apply button plugin - this provides for a callback the someone has applied for a job. So I write I've written the callback function which extracts the Job ID (a primary key in my database) and makes an ajaxAJX call to recordindcate that this Job ID has been applied for.

The Linkedin plugin is described here:

https://developer.linkedin.com/apply-processing-applicationshere.

ButIt essentially it passes this jsonJSON object to the callback:

{
   "event":"success",
   "job":{
      "companyID":"12345",
      "jobID":"9876",
      "jobTitle":"Chief Cat Herder"
   }
}

And advice I got on stackoverflow

AnywayThis is the code, which is placed within the head of the page.:

<script type="text/javascript">
function linkedInApplySuccess(jsonReturnObj) 
    {
    // no need to use any jquery json functions as already jabe a json object from linkedin (instead os a string)
    // see second answer here http://stackoverflow.com/questions/3569416/parsing-json-string-with-jquery-parsejson

    var job_id = jsonReturnObj.job.jobId;

    $.ajax({
        url: "/php/cv_db/ajax_log_linkedin_application.php",
        data: {job_id: job_id},
        type: "POST"
        });

    };
</script>

Note reRegarding the ajaxAJAX, I am not looking for any return data and nor do I care about success or failure as should it fail, I'm. I'm not going to ask someone to apply for the job again. I do have error logging in my PHP file, though.

my first jquery/json

This is my first use of jquery and json so would be grateful for any feedback please.

Background - this is on a job listing site and it has a Linkedin apply button plugin - this provides for a callback the someone has applied for a job. So I write the callback function which extracts the Job ID (a primary key in my database) and makes an ajax call to record that this Job ID has been applied for.

The Linkedin plugin is described here:

https://developer.linkedin.com/apply-processing-applications

But essentially it passes this json object to the callback:

{
   "event":"success",
   "job":{
      "companyID":"12345",
      "jobID":"9876",
      "jobTitle":"Chief Cat Herder"
   }
}

And advice I got on stackoverflow

Anyway the code, which is placed within the head of the page.

<script type="text/javascript">
function linkedInApplySuccess(jsonReturnObj) 
    {
    // no need to use any jquery json functions as already jabe a json object from linkedin (instead os a string)
    // see second answer here http://stackoverflow.com/questions/3569416/parsing-json-string-with-jquery-parsejson

    var job_id = jsonReturnObj.job.jobId;

    $.ajax({
        url: "/php/cv_db/ajax_log_linkedin_application.php",
        data: {job_id: job_id},
        type: "POST"
        });

    };
</script>

Note re the ajax, I am not looking for any return data and nor do I care about success or failure as should it fail, I'm not going to ask someone to apply for the job again. I do have error logging in my PHP file though.

Callback for job applicant

This is on a job listing site and it has a Linkedin apply button plugin - this provides for a callback the someone has applied for a job. I've written the callback function which extracts the Job ID (a primary key in my database) and makes an AJX call to indcate that this Job ID has been applied for.

The Linkedin plugin is described here.

It essentially passes this JSON object to the callback:

{
   "event":"success",
   "job":{
      "companyID":"12345",
      "jobID":"9876",
      "jobTitle":"Chief Cat Herder"
   }
}

This is the code placed within the head of the page:

<script type="text/javascript">
function linkedInApplySuccess(jsonReturnObj) 
    {
    // no need to use any jquery json functions as already jabe a json object from linkedin (instead os a string)
    // see second answer here http://stackoverflow.com/questions/3569416/parsing-json-string-with-jquery-parsejson

    var job_id = jsonReturnObj.job.jobId;

    $.ajax({
        url: "/php/cv_db/ajax_log_linkedin_application.php",
        data: {job_id: job_id},
        type: "POST"
        });

    };
</script>

Regarding the AJAX, I am not looking for any return data and nor do I care about success or failure as should it fail. I'm not going to ask someone to apply for the job again. I do have error logging in my PHP file, though.

added 1 characters in body
Source Link
Loading
Source Link
Loading