Forum Rules |
|
Выполняю код.
//_ТекстСкрипта;
Скрипт = СоздатьОбъект(«MSScriptControl.ScriptControl»);
Скрипт.Language = «JScript»;
Скрипт.AddCode(_ТекстСкрипта);
Скрипт.Run(«init»);
ТекстСкрипта равен
var socket;
var isConnect = false;
function errorConnectDefault(data) { alert(data);}
var errorConnectCallBack = errorConnectDefault;
function init() {
connectTumSocket1(«7kaIenL3KzdAEgPVeXqtgOPwJEPTm558GMesUET+60JKxNzwG0JcEl97Vs+jE/A8WAzDGr1xkYoPvbaHGYVRDw==», function (event) {
var options = {«apiKey»: «86be88c8437850fbf008f92fa0481423-76dc611d-0b1f-843f»};
// CheckAPIKey(options, function (event) {
// var data = JSON.parse(event.data);
})
});
}
function connectTumSocket1(apiKey, callback) {
socket = new WebSocket(«ws://localhost:6126/tumarcsp/»);
socket.onopen = function(){
isConnect = true;
var options = {
«apiKey»:apiKey
};
// SetAPIKey(options, callback);
}
socket.onclose = function(){
isConnect = false;
}
socket.onerror = function(event){
}
}
Выходит ошибка:
Ошибка выполнения Microsoft JScript: ‘WebSocket’ — определение отсутствует
Подскажите, плиз, что нужно сделать?
Asked
9 years, 5 months ago
Viewed
3k times
When I run my project on IE 9, I get the following error:
Microsoft JScript runtime error: ‘JSON’ is undefined
I have tried online suggestions but none of them worked for me. If i run my project using Chrome then everything works fine.
Can someone help me?
Jonathan Wood
64.9k70 gold badges264 silver badges454 bronze badges
asked Dec 31, 2013 at 1:14
5
I think your website is running in Quirk Mode in IE9, try to set the proper html doctype, you can also try Json3 script.
answered Dec 31, 2013 at 9:37
Anwar JavedAnwar Javed
3153 silver badges11 bronze badges
5
- Remove From My Forums
-
Question
-
All the HealthVault pages (i.e. those derived from HealthServicePage) of a website suddenly started to generate the following error:
Error: Microsoft JScript runtime error: ‘JSON’ is undefined
These pages used to work fine and I have not done anything to them. All other pages under the website work fine.
Any tip on how to debug this will be greatly appreciated.
hz
Answers
-
Hello ,
Thanks for the update on this issue. As i suggested in my first communication to this thread, the issue is with the browser which you are using. Try to uninstall the unnecessary add-on’s of IE or if the issue still remains re-install(clean installation)
the browser to resolve the further issue related to script errors.Hope this helps.
Regards,
Madan Kamuju
-
Marked as answer by
Wednesday, January 5, 2011 5:46 PM
-
Marked as answer by
User2027516926 posted
Hi all,
i have created wcf and call it through jquery but JSON.stringify(data) giving error my code is follows
what is wrong in this code can any one please help out me
data = JSON.stringify(data) this line giving error
WCF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using Test.AzureCloud;
namespace Test.AjaxWCF
{
[ServiceContract(Namespace = «»)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class blobServices
{
[OperationContract]
public void DeleteBlob(string ContainerName, string FileName)
{
string storeConn = Component.Configuration.GetDBConfigurationSetting(typeof(string), Common.Constants.Configkeys.storageConn).ToString();
blob blobHelper = new blob(storeConn);
blobHelper.DeleteBlob(ContainerName, FileName);
return;
}
// Add more operations here and mark them with [OperationContract]
}
}
ASPX code
<script src=»/Scripts/jquery-1.5.1.min.js» type=»text/javascript»></script>
<script type=»text/javascript»>
function fileUploadRemoving(sender, args) {
var containerN = args.get_fileInfo().containerName;
var blobN = args.get_fileInfo().FileName;
var data = { ContainerName: containerN, FileName: blobN };
data = JSON.stringify(data)
$.ajax({
type: «POST»,
contentType: «application/json; charset=utf-8»,
url: «/AjaxWCF/blobServices.svc/DeleteBlob»,
data: data,
async: true,
dataType: «json»,
success: function () {
},
error: function (msg) {
//alert(msg.d);
}
});
}
</script>
<asp:Panel ID=»pnl_Form» runat=»server»>
<table width=»100%» style=»border-style: none;»>
<tr><td>
<telerik:RadAsyncUpload runat=»server» ID=»RadAsyncUploadLogo» MultipleFileSelection=»Disabled»
MaxFileInputsCount=»1″ HttpHandlerUrl=»~/AsyncFileupload/Handler.ashx» OnClientFileUploadRemoving=»fileUploadRemoving»>
<FileFilters>
<telerik:FileFilter Description=»Logo(jpeg;jpg;gif;png)» Extensions=»jpeg,jpg,gif,png» />
</FileFilters>
</telerik:RadAsyncUpload>
</td>
</tr>
</table>
</asp:Panel>
Выполняю код.
//_ТекстСкрипта;
Скрипт = СоздатьОбъект(«MSScriptControl.ScriptControl»);
Скрипт.Language = «JScript»;
Скрипт.AddCode(_ТекстСкрипта);
Скрипт.Run(«init»);
ТекстСкрипта равен
var socket;
var isConnect = false;
function errorConnectDefault(data) { alert(data);}
var errorConnectCallBack = errorConnectDefault;
function init() {
connectTumSocket1(«7kaIenL3KzdAEgPVeXqtgOPwJEPTm558GMesUET+60JKxNzwG0JcEl97Vs+jE/A8WAzDGr1xkYoPvbaHGYVRDw==», function (event) {
var options = {«apiKey»: «86be88c8437850fbf008f92fa0481423-76dc611d-0b1f-843f»};
// CheckAPIKey(options, function (event) {
// var data = JSON.parse(event.data);
})
});
}
function connectTumSocket1(apiKey, callback) {
socket = new WebSocket(«ws://localhost:6126/tumarcsp/»);
socket.onopen = function(){
isConnect = true;
var options = {
«apiKey»:apiKey
};
// SetAPIKey(options, callback);
}
socket.onclose = function(){
isConnect = false;
}
socket.onerror = function(event){
}
}
Выходит ошибка:
Ошибка выполнения Microsoft JScript: ‘WebSocket’ — определение отсутствует
Подскажите, плиз, что нужно сделать?