When put string in function about(3000 character) all work fine, but when string is (10 000 character and more) function not working.
All string work fine when call trough webservice URL in browser.
function callJsonSync(userName, procedureName, jsonCallBackFunc) {
$.ajax({
crossDomain: true,
type: "GET",
contentType: "application/json; charset=utf-8",
async: false,
url: "webService/appws.asmx/myService?callback=?",
data: { userName: userName, procedureName: procedureName },
dataType: "jsonp",
jsonpCallback: jsonCallBackFunc,
error: function (xhr, textStatus, errorThrown) {
alert(testStatus + ' - ' + errorThrown + ' - error- ' + procedureName)
}
});
}
Is there a limit to the length?
Related
Here is my javascript codes :
$.ajax({
url: "/Users_Area/Order.aspx/Get_Server_Date",
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: "{}",
async: true,
success: function(result) {
server_date = new Date(result.d);
//alert(server_date);
var Order_id = $("#<%= hf_order_id.ClientID %>").val();
alert(Order_id);
$.ajax({
url: "/Users_Area/Order.aspx/Get_Order_Date",
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: "{'Order_id': '" + Order_id + "'}",
async: true,
success: function(result) {
order_date = new Date(result.d);
alert(order_date);
if (server_date > order_date) {
var dif_server_order_in_seconds = (server_date - order_date) / 1000;
alert(dif_server_order_in_seconds);
if (dif_server_order_in_seconds > 3600) {
} else {}
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
debugger;
}
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
debugger;
}
});
And here is console error after alert(order_date); line :
Browser Link: Failed to send message to browser link server: Error:
SignalR: Connection has not been fully initialized. Use
.start().done() or .start().fail() to run logic after the connection
has started.
How can i fix this problem?
(I am using asp.net webforms with c#)
i need to read string from my customer server.
the string that i need to call is:
http://xxx.xxx.xxx.xxx:8082/My_ws?applic=MyProgram&Param1=493¶m2=55329
The result I get is a string.
If I run it in the browser I get an answer string - OK
i need to get it in my HTML & javascript program
i try this:
function Look() {
$.ajax({
ServiceCallID: 1,
url: 'http://xxx.xxx.xxx.xxx:8082/My_ws?applic=MyProgram&Param1=493¶m2=55329',
type: 'POST',
data: '{"Param1": "' + 2222 + '"}',
data: '{"Param2": "' + 3333 + '"}',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success:
function (data, textStatus, XMLHttpRequest) {
ALL = (data.d).toString();
},
error:
function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
}
Try this, you need to use stringify if the data is Json otherwise remove JSON.stringify, you cannot have 2 data parameters either, your using utf-8 presume that is a MS web srvc, if your sending data up it's post (usually).
$.ajax({
type: 'Post',
contentType: "application/json; charset=utf-8",
url: "//localhost:38093/api/Acc/", //method Name
data: JSON.stringify({ someVar: 'someValue', someOtherVar: 'someOtherValue'}),
dataType: 'json',
success: someFunction(data), // pass data to function
error: function (msg) {
alert(msg.responsetext);
}
});
i got from my customer string that I need to get to the server and get an answer.
this is the string:
http://XXX.YYY.DDD.WWW:8082/My_ws?Myapp=Myprice&Mydip=123&itemno=123456
and i get any string as Result.
i try this in ajax and jQuery:
$.ajax({
ServiceCallID: 1,
url: MyString,
type: 'POST',
data: '{"itemno": "' + itemno+ '"}',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success:
function (data, textStatus, XMLHttpRequest) {
ALL = (data.d).toString();
}
},
error:
function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
how to "talk" with the server and get the Result from my string ?
thanks
I have the following ajax call. I want to send out the data in jason format. However I noticed in Fiddler that the data is converted to query string parameters. What I am doing wrong?
$.ajax({
type: "GET",
url: "StatusService.svc/CheckStatus",
data: JSON.stringify({"companyName":"paymins"}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert('ok!');
alter(data.toString());
},
error: function (jqXHR, textStatus, errorThrown) {
alert(textStatus + ' / ' + errorThrown);
}
});
Change the type of your request to a post.
$.ajax({
type: "POST",
url: "StatusService.svc/CheckStatus",
data: JSON.stringify({"companyName":"paymins"}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert('ok!');
alter(data.toString());
},
error: function (jqXHR, textStatus, errorThrown) {
alert(textStatus + ' / ' + errorThrown);
}
});
Get cannot contain a body. Use post for that.
I have a page, and i've got a link looking like:
<span>Nordjylland</span>
And in my Javascript file, i've got a function called GetCitiesByRegion(), however, when clicking the link, i get an error, saying that GetCitiesByRegion is not defined?
The function looks like this:
function GetCitiesByRegion(id) {
var params = '{"id":"' + id + '"}'
var request = {
type: "GET",
async: false,
cache: false,
url: "http://" + location.hostname + "/webservices/services.svc/GetCitiesByRegion",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: params,
success: function (result) {
alert("Data Loaded: " + result);
},
error: function (xhr, status, error) {
alert('Fejl ved webservice: error: ' + error);
}
};
$jq.ajax(request);
}