I have this HTML and script :
<form>
Text :<br>
<input type="text" name="nameid" id="nameid" value="">
<br><br>
<input type="submit" value="Send">
</form>
$(document).ready(function () {
$("form").submit(function (event) {
$.ajax({
type: 'GET',
url: "/MyController/MyAction2",
data: { nameid: $('#nameid').val() },
success: function (newdata) {
var cy = cytoscape({
container: document.getElementById("cy"),
elements: JSON.parse(newdata)
});
});
}
});
});
});
When MyAction2
is called from AJAX, the url goes to MyAction2
and I see raw JSON data. How can I make MyAction2
returns value to the AJAX and I would use it as newdata
variable? Thanks.