Jump to content
Sign in to follow this  
lastlifelost

AJAX issue with selective reloading

Recommended Posts

I'm using the following code to reset a contact form. It's working fine to remove the entered data, but it's not resetting the HTML the way I think it should

function selectiveReload(section, url) {	//contrstucts the jQuery-compliant id	sectionId = "#" + section;		//OPTIONAL: determines the page to grab new content from.  	//If left blank, will load content from the current page	url = (url === undefined) ? document.location : url;		//determines the original element's tag name for use with inserting the new content	tag = ($(sectionId).get(0).tagName);	tag = '<'+tag+'><\/'+tag+'>';		//loads and inserts the new content	content = $(sectionId).load(url + ' ' + sectionId).html();	content = $(tag).attr("id",section).html(content);	$(sectionId).replaceWith(content);}

What's happening is when a bad email address or blank line is found, another script will flag it, show an error message and add some styling. The reset script above should be grabbing the whole form fresh from the server and replacing that content block in the HTML, thus removing the styling and the data entered (if any). An example can be seen here: http://stweb.ccv.edu/CIS-2140-VO01-V11SP/s...ments/9test.php. Am I missing something important or am I asking for something that can't be done in this way?

Edited by lastlifelost

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...