[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

jquery jeditable - refresh page after saving specific field

Posted on 2010-04-08
5
Medium Priority
?
1,812 Views
Last Modified: 2012-05-09
Hello,

I am using jQuery Jeditable plug-in for in-place editing.

http://www.appelsiini.net/projects/jeditable

In one website I have four different jeditable fields.

| title || value || value2 || value 3 || live link: a href $title.html |

I'd like to automatically refresh whole page after first field - Title is edited through Jeditable and clicked Save button. It is for last field - a href $title.html to be updated with new title value.

Code I am using is below.

Thanks for any ideas!

Cheers
Adam

$(".el_wrap .c2 p").editable("./core/save-title.php", { 
      indicator : "<img src='./images/indicator.gif'>",
      tooltip   : "Click to edit...",
      submit    : 'Save',		
});


// HTML just to be clear
<div class="el_wrap">
	<div class="c2">
		<p><? echo $row['title'] ?></p>
	</div>
	
	<div class="c1">
		<ul>
			<li><a href="./<? echo $row['title']; ?>.html">Products</a></li>
		</ul>
	</div>
</div>

Open in new window

0
Comment
Question by:Aidam-Unlimited
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:racmail2001
ID: 30118622
can you try this?

$(".el_wrap .c2 p").editable("./core/save-title.php", {
      indicator : "<img src='./images/indicator.gif'>",
      tooltip   : "Click to edit...",
      submit    : 'Save',              
}).ready(function() {location.reload();
});

hope it helps
0
 

Author Comment

by:Aidam-Unlimited
ID: 30118829
Hi, thanks but it is refreshing page in a loop without clicking anywhere...
0
 
LVL 10

Accepted Solution

by:
racmail2001 earned 2000 total points
ID: 30119155

make the save buton with an class of save

and try this one

$(".save").click(function(){location.reload();});

i think that it should have a delay also ... anyway the function to reload the page it's location.reload(); so the rest it's to figure aut how it should be linked in your code

hope it helps
0
 

Author Comment

by:Aidam-Unlimited
ID: 30119709
Many thanks to your suggestion I've done it exactly as I needed.

If anybody would like to see a solution:
$(".el_wrap .c2 p").editable("./core/save-title.php", { 
      indicator : "<img src='./images/indicator.gif'>",
      tooltip   : "Click to edit...",
     	submit  : 'Save',
		 cssclass : 'jedi',
		 callback : function() {
					location.reload();
     				}
  });

Open in new window

0
 

Author Closing Comment

by:Aidam-Unlimited
ID: 31712321
Thank you!!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

612 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