Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have two websites like web1 and web2,in web2 i have web services function and return value to web1.I mean i use web2 as database connection for retrieve and store value using web2 web services.Form web1 i will call web service. Below one is web service call form web1

XML
function EPlogin(epusername, eppwd) {
				    try {
                       
						$.ajax({
						    type: "POST",
						     url: "http://192.168.168.91/web2/EPService.asmx/EP_Login",
							data: "{username: '" + encodeURIComponent(epusername) + "', pwd: '" + encodeURIComponent(eppwd) + "'}",
							contentType: "application/json; charset=utf-8",
							dataType: "json",                               
							jsonpCallback: "success",
							success: function (result) {
								                            
								var loginfo = eval(result.d);
					if (loginfo.lengthgt; 1) {
						                         
                                    window.location = "home_kendo.html";
                                   }
								else {
								    alert(loginfo[0]);
									$("#ErrorDiv").text(loginfo[0]);									
								}
							},
							fail: function (msg) {
							      alert(msg.statusText);
							if (msg.status == 0) {
									$("#ErrorDiv").text("No internet connection or Server down");                                        
								}
								else {                                        
									$("#ErrorDiv").text(msg.statusText + " " + msg.status);
								}
                                                                   
								
							}
						})
					}
				    catch (ex) {
				        alert(ex.message)
						$("#ErrorDiv").text(ex.message);
					}
}


In above i mention addressees and root folder name(web2),in that if ip address can't connect or if root folder is wrong,that time i need to show error message.So how to show error message.

Note:In above catch or fail function i dint get any error,if i use F12 and check in browser then only i get error message.like unreachable address or net::ERR_CONNECTION_TIMED_OUT. Pls check below link.

http://prntscr.com/51hblc[^]

I need to check in coding itself,not like paste url link browser and check,i need error message alert.

Regards
Aravind
Posted
Updated 30-Oct-14 16:05pm
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900