Unable to get latlang values returned by javascript on server side

I'm having an ArcGIS map and when i click on the save button by entering details, I'm calling a javascript function which checks for whether the input lat lang values are inside/outside the state or not. On save button click event, I'm calling a function that returns the latlang values fall under the state or not. That function is linked to 8 other chained javascript functions.

Before getting the result from the javascript, my server side page is getting loaded. How to return the value from this function? Please help me out. Below is the code;