?
Solved

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

Posted on 2011-03-06
2
Medium Priority
?
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
GregArnott earned 2000 total points
ID: 35049912
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
ID: 35098040
Awesome! It worked!

Thanks,

Brian
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

777 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