Response ajax jquery form undefined -
i have javascript code, don't use php, , when try submit form object ("data") undefined. try lot of changes, configuration form sends response undefined ...
$(this).html('<div id="contactable_inner"></div><form id="contactform" class="contactform" method="post" onsubmit="return false;">' + '<p><label for="id">' + options.id + '</label><input id="id" class="contact_id" name="id" value="" disabled="disabled"/>' + '<p><label for="name">' + options.name + '</label><input id="name" class="contact" name="name"/>' + '<p><label for="select">' + options.select + '</label><select id="select" class="select" name="select">' + '<option value="error">error</option>' + '<option value="consulta">consulta</option>' + '<option value="sugerencia">sugerencia</option>' + '<option value="aviso">aviso</option>' + '<option value="otro">otro</option></select>' + '<p><label for="phone">' + options.phone + '</label><input id="phone" class="contact" name="phone"/>' + '<p><label for="email">' + options.email + '</label><input id="email" class="contact" name="email" />' + '<p><label for="message">' + options.message + '</label><textarea id="message" name="message" class="message" rows="4" cols="30" ></textarea>' + '<p><input class="submit" id="enviar" type="submit" onclick="return validateform();" value="' + options.submitbutton +'"/><input id="cancelar" class="button" type="button" onclick="closedialog()" value="'+ options.cancelbutton + '"/></p></form>' ); if(enviaemail == true) { try { $("#contactform").submit(function() { $.ajax( { type: "post", url: options.url, cache: false, crossdomain: true, datatype: "script", async: false, jsonp: false, timeout: 3000, data : { accion: 'setnotificacion', idusuario : $(this_id_prefix+ '#id').val(), nomusuario : $(this_id_prefix+ '#name').val(), tlfuser : $(this_id_prefix+ '#phone').val(), emailuser : $(this_id_prefix+ '#email').val(), tipocons : $(this_id_prefix+ '#select').val(), textocons : $(this_id_prefix+ '#message').val(), dirmailinci : options.dirincidencias, servidorcorreo : options.servidorsmtp, fromdelmail : options.frommail, nomaplicacion : options.nombreaplicacion, } }) .done(function(data) { console.log(data); if(data == "true") { alert('notificación enviada satisfactoriamente.'); closedialog(); } else { alert('error enviando los datos al servicio. puede que algún parámetro sea incorrecto.'); } }) .fail(function(jqxhr, textstatus) { alert('error enviando los datos al servicio. el servicio no está disponible en estos momentos.'+textstatus); }); }); } catch(err) { txt="there error on page.\n\n"; txt+="error description: " + err.message + "\n\n"; txt+="click ok continue.\n\n"; alert(txt); }
any suggestion ?? thanks
Comments
Post a Comment