Code working fine in Chrome but not in Firefox

See the below code. Same code working fine and get success response. But in Firefox same code giving error Message. Not sure what is issue…
Please help…

function callRest(restAddress, employeedetails, objExperienceDetails, objEducationDetails) {
jQuery.support.cors = true;
$.ajax({
url: restAddress,
type: “POST”,
contentType: “application/json; charset=utf-8”,
dataType: ‘json’,
data: escapeNewLineChars(JSON.stringify({ “item”: employeedetails, “itemExperienceDetails”: objExperienceDetails, “itemEducationDetails”: objEducationDetails })),
success: function (data) {
alert(data.d);
console.log(data.d);
},
error: function (x, y, z) {
//alert(“At this time, the tool only supports content from LInkedIN.com profiles”);
console.log(“REST API call failed with error:” + x.responseText + y + z);
}
});
}

Please format your code and give us the error message you are receiving.

{“FullName”:“Prerna Gupta”,“Title”:“Founder & CEO, HOOKED”,“CurrentLocation”:“San Francisco Bay Area”,“Industry”:"",“CurrentExp”:"",“PastExp”:"",“Education”:"",“Email”:"",“Phone”:"",“IM”:"",“PublicURL”:"",“summary”:“Prerna Gupta is a serial entrepreneur, investor, and author. Her writing has been featured in New York Times, TechCrunch, Huffington Post, Forbes, Re/code and more. She was previously Chief Product Officer and Chief Marketing Officer at Smule, where she remains an advisor to the Board of Directors. Prior to that, Prerna was Co-Founder and CEO of Khush, the leading developer of intelligent music apps, like the #1 hit app Songify, an app that turns speech into music. She led the company to profitability and acquisition by Smule in 2011. She was also responsible for producing viral videos for her products that have reached over 250 million views. Before her foray into entrepreneurship, Prerna worked in consulting at Monitor Group and early-stage venture capital at Summit Partners. She studied Economics at Stanford University, where she graduated Phi Beta Kappa in 2004. Prerna was voted one of FastCompany’s Most Influential Women in Technology 2011. She is also a budding angel investor and Resident Mentor at 500 Startups. //LP at 500 Startups //Resident Mentor at 500 Startups //Advisor at Smule //FastCompany’s Most Influential Women in Tech 2011 //FastCompany’s Most Creative People in Business //Published in New York Times, TechCrunch, Forbes, Re/code, Huffington Post, FastCompany, VentureBeat, The Next Web\n “,“additionalinfo”:””,“backgroundorganizations”:"",“backgroundhonors”:"",“backgroundprojects”:"",“backgroundlanguages”:"",“clientID”:“9199”,“userName”:“jmorris”,“password”:“devdev7878”,“pagetype”:“Candidate”} myscript.js:21:13
"[{“Position”:“Founder & CEO”,“CompanyName”:“HOOKED”,“WorkingFrom”:“Oct 2014 “,“WorkingTo”:” Present”,“TotalWorkDuration”:“Oct 2014 – Present”,“WorkLocation”:“San Francisco Bay Area”,“WorkSummary”:"\n HOOKED is redefining fiction for the Snapchat generation: http://hooked.co\n “},{“Position”:“Author”,“CompanyName”:“Sci-fi Fantasy Trilogy”,“WorkingFrom”:“Oct 2013 “,“WorkingTo”:” Present”,“TotalWorkDuration”:“Oct 2013 – Present”,“WorkLocation”:”",“WorkSummary”:""},{“Position”:“Board of Directors (Observer)”,“CompanyName”:“Smule Inc.”,“WorkingFrom”:“Dec 2011 “,“WorkingTo”:” Present”,“TotalWorkDuration”:“Dec 2011 – Present”,“WorkLocation”:“San Francisco, CA”,“WorkSummary”:""},{“Position”:“Chief Marketing Officer”,“CompanyName”:“Smule, Inc.”,“WorkingFrom”:“Jul 2013 “,“WorkingTo”:” Sep 2013”,“TotalWorkDuration”:“Jul 2013 – Sep 2013”,“WorkLocation”:“San Francisco, CA”,“WorkSummary”:""},{“Position”:“Chief Product Officer”,“CompanyName”:“Smule Inc.”,“WorkingFrom”:“Jan 2013 “,“WorkingTo”:” Jul 2013”,“TotalWorkDuration”:“Jan 2013 – Jul 2013”,“WorkLocation”:“San Francisco, CA”,“WorkSummary”:"\n \n “},{“Position”:”",“CompanyName”:"",“WorkingFrom”:"",“TotalWorkDuration”:"",“WorkLocation”:"",“WorkSummary”:""}]" myscript.js:22:13
[{“InstitueName”:“Stanford University”,“CourseName”:" “,“CourseStart”:”\n 2000 “,“CourseEnd”:” 2004\n "}] myscript.js:23:13
Object { readyState: 0, getResponseHeader: getResponseHeader(), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(), overrideMimeType: overrideMimeType(), statusCode: statusCode(), abort: abort(), state: state(), always: always(), catch: catch(), 9 more… } myscript.js:100:13

Please help me really not able to understand why same code not working in FF which same service working in chrome and getting results perfectly.

not able to understand why same code not working in FF which same service working in chrome

Because they are different browsers and the APIs for addons are not identical.

Can you suggest solutions for that. Really I am struggling to get solutions for that. Appreciate your help Eric.

Hello Praveen,

Your code is difficult to read because you didn’t format it. But here are my questions so far:

  1. You are using jQuery. Are you sure the jquery module is getting loaded into your addon?
  2. You mentioned, “in Firefox same code giving error Message” but you did not mention the error message. What is it?
  3. You have console.log in your code, along with alert(). I would definitely remove alert(). What messages do you see in the console log, if any?
  4. Your jquery.ajax() data property contains javascript code. I haven’t seen that before. Are you sure that works? (It may be fine, I’m just saying that I’m not used to seeing that and want you to be sure it doesn’t cause an error)

{“FullName”:“Praveen (Ghosh) Kumar”,“Title”:“Delivery Head |Blockchain | Project Management | Solutions Architect| Mobile Apps| Consultant”,“CurrentLocation”:“Bengaluru, Karnataka, India”,“Industry”:"",“CurrentExp”:"",“PastExp”:"",“Education”:"",“Email”:"",“Phone”:"",“IM”:"",“PublicURL”:"",“summary”:"",“additionalinfo”:"",“backgroundorganizations”:"",“backgroundhonors”:"",“backgroundprojects”:"",“backgroundlanguages”:"",“clientID”:“9199”,“userName”:“jmorris”,“password”:“devdev7878”,“pagetype”:“Candidate”} myscript.js:24
[{“Position”:“Delivery Consultant”,“CompanyName”:“IT Consultant with Multiple Agencies”,“WorkingFrom”:“May 2017 “,“WorkingTo”:” Present”,“TotalWorkDuration”:“May 2017 – Present”,“WorkLocation”:“Bangalore”,“WorkSummary”:""},{“Position”:“AGM”,“CompanyName”:“Champion InfoMetrics”,“WorkingFrom”:“Apr 2016 “,“WorkingTo”:” Present”,“TotalWorkDuration”:“Apr 2016 – Present”,“WorkLocation”:“Bangalore”,“WorkSummary”:""},{“Position”:“Sr Project Manager”,“CompanyName”:“Strategic Outsourcing India Pvt Ltd”,“WorkingFrom”:“Aug 2007 “,“WorkingTo”:” Jun 2016”,“TotalWorkDuration”:“Aug 2007 – Jun 2016”,“WorkLocation”:“bangalore”,“WorkSummary”:"\n Strategic Outsourcing India Pvt Ltd is a marketing outsourcing solutions provider, specializing in online Marketing and Data Solutions. Our experience and expertize in the market has enabled us to coin some of the most unique and revenue generating channels in the Online World. We provide Agile based software solution to the clients.\n “},{“Position”:“Project Manager”,“CompanyName”:“Infomaze Technologies”,“WorkingFrom”:“Jun 2005 “,“WorkingTo”:” Aug 2007”,“TotalWorkDuration”:“Jun 2005 – Aug 2007”,“WorkLocation”:“New Delhi and Mysore Area, India”,“WorkSummary”:”\n •Developed CRM System and many more client based Application towards world class level with respect to performance, process and people.\n “},{“Position”:“Sr Developer & Team Leader”,“CompanyName”:“Infomaze Technologies”,“WorkingFrom”:“Jun 2003 “,“WorkingTo”:” May 2005”,“TotalWorkDuration”:“Jun 2003 – May 2005”,“WorkLocation”:“New Delhi Area, India and Mysore”,“WorkSummary”:”\n Worked on Client based project. Worked with CRM, Recruitment, Entertainment on providing end-to-end eCommerce solution helping them in expanding business base in North America,Australia etc.\n “}] myscript.js:25
[{“InstitueName”:“Indira Gandhi National Open University”,“CourseName”:” “,“CourseStart”:”\n 1999 “,“CourseEnd”:” 2001\n “},{“InstitueName”:“Indira Gandhi National Open University”,“CourseName”:” “,“CourseStart”:”\n 1996 “,“CourseEnd”:” 1999\n "}] myscript.js:26
REST API call failed with error:undefinederror

Problem is response i am not getting from server which same parameter as a data mentioned above working in Chrome…
Not sure what is issue. Please help

Hi Praveen,

Are you able solve the issue? If you did, can you share the solution to me? Im getting the same issue. My code is working properly in Chrome but its getting an error in Firefox…

I suggest starting a new question with details about the exact error message you are getting.

Hi, im getting ‘undefined’ error message