I'm trying to post a form information but I'm not really sure how to do it.
This is my C # form:
@using (Html.BeginForm("Enviar", "Mensagem", FormMethod.Post, new { enctype = "multipart/form-data", @class = "", @id = "formNovaMsg" }))
{
<div class="">
<div style="display: none;">
<input id="LojaId" name="LojaId" value="@Model.LojaId" />
</div>
<div style="display: none;">
<input id="ClienteId" name="ClienteId" value="@Model.Mensagens[0].ClienteId" />
</div>
<!-- /.box-body -->
<div class="box-footer">
<div class="input-group">
<input type="text" id="Conteudo" name="Conteudo" placeholder="Escreva sua mensagem ..." class="form-control">
<span class="input-group-btn">
<button type="submit" id="btnSubmit" class="btn btn-warning btn-flat">Enviar</button>
</span>
</div>
</div>
<!-- /.box-footer-->
</div>
}
In order to give the post I followed an example that resulted in the following function:
$("#formNovaMsg").ajaxForm({
type: "post",
beforeSubmit: function (arr, $form, options) {
loading();
},
success: function (data) {
if(!data.Erro){
$("#conversa").append(data.Html);
$("#formNovaMsg")[0].reset();
$(".msgsis").fadeOut(300);
var elem = document.getElementById('conversa');
elem.scrollTop = elem.scrollHeight;
}
}
});
This view is a kind of chat the idea and he send the message and give the direct post.
When I'm trying this way I'm trying the error Uncaught TypeError: $(...).ajax is not a function
I checked Jquery and are not conflicting (I have only 1, 1.9.1).