gotornot Posted February 16, 2014 Share Posted February 16, 2014 Hi i wonder if you can help. I am trying to use a ajax call to collect data from a php file i managed to get this to work but how do i get the value of "Response" to output in html on the page after a form is submitted?$('form.ticketform').on('submit', function(){ var that = $(this), url = that.attr('action'), type = that.attr('method'), data = {}; that.find('[name]').each(function(index, value) { var that = $(this), name = that.attr('name'), value = that.val(); data[name] = value; }); $.ajax({ url: url, type: type, data: data, success: function(response){ return response; } }); return false;}); Link to comment https://forums.phpfreaks.com/topic/286245-ajax-jquery-issue/ Share on other sites More sharing options...
Ch0cu3r Posted February 16, 2014 Share Posted February 16, 2014 Change return response; to $('.response').html(response); Now add <div class="response"></div> in your page where you want the response to be displayed. Link to comment https://forums.phpfreaks.com/topic/286245-ajax-jquery-issue/#findComment-1469177 Share on other sites More sharing options...
gotornot Posted February 16, 2014 Author Share Posted February 16, 2014 Your a star thank you soooo much Link to comment https://forums.phpfreaks.com/topic/286245-ajax-jquery-issue/#findComment-1469178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.