Click here to Skip to main content
12,891,469 members (50,912 online)
Rate this:
Please Sign up or sign in to vote.
I am developing an application in that i have to get data from a web service for that i have used javascript and json the code is working in IE only and i want all browser compatibility
Posted 5-Nov-12 17:30pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

var options = {

type: "POST",
contentType: "application/json",
url: ImportInquiryurl,
data: JSON.parse(objinquirys),
dataType: "json",
success: function (msg) {
document.getElementById('<%= txtFirstname.ClientID %>').value = "";
document.getElementById('<%= txtLastName.ClientID %>').value = "";
document.getElementById('<%= txtCompanyName.ClientID %>').value = "";
document.getElementById('<%= txtPhoneNumber.ClientID %>').value = "";
document.getElementById('<%= txtemailaddress.ClientID %>').value = "";
document.getElementById('<%= txtTopic.ClientID %>').value = "";
document.getElementById('<%= txtNotes.ClientID %>').value = "";
document.getElementById('<%= txtZip.ClientID %>').value = "";
document.getElementById('<%= ltrMessage.ClientID %>').innerHTML = "Inquiry Created Successfully";
failure: function (error) {

The code for which i want browser compatibility
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Unfortunately IE still doesn't support native JSON. There is a very good polyfill. Called JSON2. Here is the CDN;[^]
Meghal Modi 6-Nov-12 23:50pm
This works well with IE but doesnt work with Chrome,FF and Safari.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100