Solved

Need some help with .ajax/jquery loading content after $.ajax post request.

Posted on 2011-03-06
2
265 Views
Last Modified: 2012-05-11
Hello, I'm getting comments to load into the db just fine with the POST $.ajax request but during the success part I'm trying to load the id results with the index.cfm page. Doesn't seem to be working with what I have so far.

Thanks,

Brian
$("form#frmComment").submit(function(){

	var datastring= $('form#frmComment').serialize();
	$.ajax({
		type: "POST",
		url: "inc_comments.cfm",
		cache: false,
		data: datastring,
		success: function(){
			$("#results").get("index.cfm");
		}
	});// .ajax()
  }); // .submit()

Open in new window

0
Comment
Question by:brihol44
2 Comments
 
LVL 6

Accepted Solution

by:
GregArnott earned 500 total points
Comment Utility
As you've made the submit, success and response in one, I believe you need to sync the return data for it to work.

ie:
$("form#frmComment").submit(function(){

	var datastring= $('form#frmComment').serialize();
	$.ajax({
		type: "POST",
		url: "inc_comments.cfm",
		cache: false,
		data: datastring,
		[b]async:false,[/b]
		success: function(){
			$("#results").get("index.cfm");
		}
	});// .ajax()
  }); // .submit()

Open in new window


Alternatively, set the process into the trilogy of $.ajaxSetup(), $.ajax() and $.ajaxSuccess()
0
 

Author Closing Comment

by:brihol44
Comment Utility
Awesome! It worked!

Thanks,

Brian
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to dynamically set the form action using jQuery.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now