You are not logged in.

  • Login

Hups

Unregistered

1

Wednesday, January 19th 2011, 5:28pm

AJAX Comment Script mehrmals auf einer Seite

hallo ich habe dieses script

http://www.planetsourcecode.com/vb/scrip…d=2413&lngWId=8

und eine webseite wo auf einer seite mehrere einträge sind ,ich möchte nun das dieses script für jeden einzelnen eintrag angezeigt bzw comments geschrieben werden können

JavaScript Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$(document).ready(function(){
  $(".comment_table").find('textarea, input:text').blur(function () {
	if ($(this).val() != ''){
		$(this).removeClass("required");
	}
  });	
  $("#submit").click(function(){
	  var anyBlank = 0;
	  $(".comment_table").find('textarea, input:text').each(function () {
		if ($(this).val() == ''){
			$(this).addClass("required");
			anyBlank = 1;
		}
	  });	
	  if(anyBlank == "0")
	  {
		  var name	= $("#name").val();
		  var email   = $("#email").val();
		  var comment = $("#comment").val();
		  comment = comment.replace(/\n\r?/g, '<br />');
		  $("#loading").css("visibility","visible");
			$.ajax({
			   type: "POST",
			   url: "ajax_server.php",
			   data: "name="+name+"&email="+email+"&comment="+comment,
			   success: function(date_added){
				  if(date_added != 0)
				   {
					   structure = '<div class="comment_holder"><div id="photo"><img src="images/user.gif" width="60" height="70"><br>'+name+'</div><div id="comment_text"><div id="date_posted">'+date_added+'</div>'+comment+'</div></div>';				  	
					   $(".no_comments").fadeOut("slow");
					   $("#ajax_response").prepend(structure);
					   $(".comment_table").find('textarea, input:text').each(function () {
						   $(this).val("");
					   });
				   }
				  else
					  alert("Unexpected error...!");
  					  $("#loading").css("visibility","hidden");
			   }
			 });
	  }
  });
  $("#ajax_response").mouseover(function(){
	 $(this).find(".comment_holder").mouseover(function(){
		$(this).addClass("highlight");
	 });
  });
  $("#ajax_response").mouseout(function(){
	 $(this).find(".comment_holder").mouseout(function(){
		$(this).removeClass("highlight");
	 });
  });
});


hatte das mal verdoppelt und den submit id eine 2 angehängt das geht aber nicht , dann funzt nix mehr

Mfg

2

Wednesday, January 19th 2011, 6:09pm

Hi, da muss ich dich leider enttäuschen.
Das Script ist nicht flexibel programmiert. Überall im Script werden IDs referenziert und IDs sind nunmal einmalig.
Vermutlich ist das Aufwand geringer bei Null anzufangen, statt das Script zu erweitern.

Hups

Unregistered

3

Wednesday, January 19th 2011, 6:55pm

schade hast du mal ein tip wo solche scripts zu bekommen sind ??

4

Wednesday, January 19th 2011, 8:54pm

Tut mir Leid, leider keine Idee. Solche Sachen sind ziemlich individuell und daher besser selbst umzusetzen.

Social bookmarks