I've written the following script:
<script>
$("#sendMSG").click(function () {
$.ajax({
type: "POST",
url: '@Url.Action("Action", "Controller")',
dataType: "JSon",
data: { "Email": '@ViewBag.Email' },
success: function (data) {
document.getElementById("Output").innerHTML = data.Message;},
error: console.log("It did not work"),
});
});
</script>
When I examine the source frames, I see this: "Email": '[email protected]' },
It appears to be retrieving it, but when I call the controller below:
public JsonResult ThankYou(string Email)
{
}
it returns a null value. If you have any insights on why this might not be functioning correctly, or need more information/code, please feel free to ask and I will provide it.
Thank you
EDIT:
This is the original form code for submitting other information:
[[Form_SmsPhone]]
<form action="\Controller\Action" id="smsPhone" method="post">
[[/Form_SmsPhone]]
[[Block_Sms]]
<div class="input-append">
<input id="phonenumber" style="width: 115px;" name="phonenumber" type="text">
<button class="btn" type="submit" value="Send" id="sendMsg">Send</button>
</div>
<p id ="Output"></p>
[[/Block_Sms]]
[[Form_End]]
</form>
[[/Form_End]]