Handle Submit event in jquery code like below:
$('#submitbutton').click(function(e){
e.preventDefault();
.......
.......
}
For JSON response add
dataType: 'json'
to ajax request and then you can use encoded data with period(.) sign. for example:
alert(data.msg);