Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi friends, I have done one web application in which I have used almost HTML COntrols and Jquery ajax to call the web service and my web service is the main where I have my database. so I have uploaded in two diff. locations on to the server.

on local host I am very happy that I am able to call the service and I am able to Insert, Get and Update db values but when I uploaded into the server I am unable to call the service I mean when I am adding an Item through the jquery ajax call I am not even getting any errror nor success. I have changed the Url to the service location and also changed the Web.config file even though I am un able to get contact with the service.

how can I detect what the error may be?


My Service is working in IE only when I check in firefox and chrome the msg from a service is returns a null value.

here is my sample AddItem jquery ajax calls

try {
alert("In Add Item Js Function 2");
$.ajax
({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://bruhasapps.com/rentsvc/InventoryService.asmx/AddItem",
data: ItemDetails,
dataType: "json",
success: OnSuccess,
error: OnFail
});
alert("In Add Item Js Function 3");
}
catch (err) {
alert("Error in Add Items " + err.Message);
}
}


C#
function OnSuccess(msg) {
alert("In Succ Fun " +msg);
var str = msg.d;
alert("Max Item Id " + str);
if (str !=null)
{
alert("Item Inserted Successfully");
$("#txtItemname").val('');
$("#txtMake").val('');
$("#txtModel").val('');
$("#txtYear").val('');
$("#txtDescription").val('');
document.getElementById('lstItemCode').selectedIndex = 0;
}
else
{
alert("There is some Problem in Inserting Data. Please Try again.");
}
}

function OnFail(request, status, error) {
 $("#lblErrIname").html("Error Occured <br>" + request.responseText);
}



Please tell me some sort of solving technique
Thanks
Ganesh
Posted
Updated 24-Oct-12 20:42pm
v2
Comments
bbirajdar 24-Oct-12 13:47pm    
Hmmm..That is really a complicated issue..I will be happy if I can help you solve it... I have started thinking and guessing what code you must have written and the possible guesses about the mistakes you must have made... Hold on till then...
Al Moje 24-Oct-12 21:06pm    
Could you post your code snippets so that we could analyze what wrong on your code?
Ganesh KP 10-Nov-12 4:03am    
I have a lot of code that deals with the service? Which part should I need to post that code that interacts with the service. then here it is?

function GetAllItems()
{
var aid = 1;
var param = '{"AgencyId":"' + aid + '"}';
try
{
$("#lblLoading").html("Loading Please Wait...");
$.ajax
({
type: "POST",
async: false,
contentType: "application/json; charset=utf-8",
url: WebSvcUrl+"/GetAllItems",
data: param,
dataType: "json",
success: OnSuccessGetAllItems,
error: OnFailOfGetAllItems
});
}
catch (err)
{ alert("There was a trouble in Get All Items. Please Try again"); }
} // of Get All Items

function OnSuccessGetAllItems(msg)
{
try
{
AllItems = msg.d;
$("#AddItemDiv").hide('slow');
$(".txtboxCSS").attr('disabled', 'disabled');
$(".txtareaCSS").attr('disabled', 'disabled');
$("#lstItemCode").attr('disabled', 'disabled');
if (AllItems.length == 0)
{ $("#lblLoading").html("No Results Found!"); }
else
{ $("#lblLoading").html(""); }

$("#DivItemRes").html('<label for="Caption" style="font-family:Verdana ; font-size:larger; font-weight:bold; font-variant:small-caps; color:#5190cf;">Result Panel</label><div class="gapDiv"></div>');

for (x in AllItems)
{
ThisItem = AllItems[x];
$("#DivItemRes").append('<div id="Item_' + ThisItem.ItemId + '" class="subdiv">' + ThisItem.ItemType.Itemname + '</div>');
$("#DivItemRes").append('<div class="gapDiv"></div>');
$("#DivItemRes").show(1000);
}

}
catch (err)
{ alert("There was a trouble in Get All Items. Please Try again"); }
} // on func succ get all items

function OnFailOfGetAllItems(request, status, error)
{ $("#lblErrIname").html("Error Occured in Get All Items<br>" + request.responseText); }

similarly all other javascript functions that are interacted with service will be alike Mr Al MOje
Al Moje 11-Nov-12 23:56pm    
Have you declare your Entity class as Serializable?
Example:

[Serializable]
public class Contract_Hdr
{
//...
//...
}
Ganesh KP 22-Nov-12 23:16pm    
Naoh I am not using any serialization? Does it is mandatory to use seralization?

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