I've gotten a "ReferenceError: function is not defined on the saveRoute function". Everything seems right to me but i could not figure out the problem.
Here is the related codes.
<script type="text/javascript">
var array = routeobj;
function saveRoute(){   
var json = JSON.stringify(array)
$.ajax({
    url : "http://192.168.1.9:11123/runornot/drawtrack",
    type: "POST",
    dataType:'json'
   data : {json:json}
       {"routeJson": json },
       console.log("hellohelloworldolr");
    success: function(data, textStatus, jqXHR)
    { //data - response from server
        console.log("checkin success"); },
    error: function (jqXHR, textStatus, errorThrown)
    {
    }});}
</script>    
and in the html
 <a href="#" onClick="saveRoute();" id="savebtn" class="ui-btn ui-corner-all ui-btn-a">Save</a>    

dataType: 'json'needs a comma after it, and then the three lines immediately afterword that are supposed to be the value fordata:are seriously weird. What are you trying to do there?