Java Script function appears not to be returning a value?
Posted on 2016-08-04
I have some code in a Java Script.js file. I have a function named TestForValue() which calls a function named CheckValue();
CheckValue makes an Ajax call down to an MVC C# method, and returns a value. It all works great, however the string value (True or False) is not being returned from the method TestForValue. At line 3 and 4 below when line 4 below is executed nothing
is displayed in the alert box. I don't know why, because my CheckValue() method will return either true or false. So I don't know why
the value on line 3 and 4 below is coming back as an empty string. Does an Expert have any idea why CheckValue is not return my
I did not know wether to place this question in the Java Script Section or Ajax section, so I placed it in the Java Script section.
1 function TestForValue()
3 var x = CheckValue();
ContentType: 'application/json; charset=utf-8',
success: function (isOk)
if(isOk = "Success")
alert(isOk); // Yes the message box displays the word "Success"