I have gone through multiple posts on this topic, but unfortunately I am unable to resolve my issue. It seems quite challenging for me: I am facing an obstacle with a simple C# code that is supposed to retrieve the tracking status of a submitted factor in the ShoppingController class. Here is the code snippet:
public string StatusOfFactor( string guid )
{
// note that guid was being trimmed in javascript
Factor factor = (from Factor fact in db.Factors
where fact.TrackingCode.ToString() == guid
select fact).First();
return factor.StatusOfFactor;
Additionally, I have a JavaScript function that calls this method as shown below:
function TrackPurchase() {
var txtTrackingPurchase = $("#inputpeygiry");
var guid = $.trim(txtTrackingPurchase.val());
var urlMain = 'ShoppingController/StatusOfFactor';
alert(urlMain);
$.ajax({
type: 'GET',
url: urlMain,
cache: false,
data: guid,
success: function (returnVal) {
alert("I am sucess function");
$("#StatusOfFactor").html(returnVal);
},
error: function (e) {
$("#StatusOfFactor").text("nothing is really exist");
}
});
}
Please note that there is a textbox with id="inputpeygiry"
which captures the tracking code entered by the user. The above JavaScript function is triggered upon clicking the button below:
<input type="button" class="btn btn-success pull-left" id="btnpeygiry" value="Track Purchase" onclick="TrackPurchase()"/>
The main issue at hand is that the success function never gets called! Can someone please assist me in resolving this dilemma?