Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-02-2011, 11:45 PM   PM User | #1
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 794
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
AJAX request being sent 15+ times

This is on a shoutbox, each shout have a delete link where and admin can delete the shout.

Its a link with onclick =\"deleteShout()\" in it.

The function is this.

Code:
function deleteShout(e){
			e.preventDefault();
			var ID2 = $(this).attr("href");
			$.ajax({
				type: "POST",
				url: "_aGadminCp/modules/editShoutbox.php",
				data: "ID="+ID2,
				success: function(msg){
					popUp(msg);
				}
			});
		}
Is it running multiple times before more than one link has the function on it? If so how could i stop it doing that?

EDIT: I changed the wrong part of my code, now when i click the link i get e is not defined and the link goes to the number in the href, how can i stop that happening?

Last edited by tomharto; 10-02-2011 at 11:54 PM..
tomharto is offline   Reply With Quote
Old 10-03-2011, 12:43 AM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
i think your going to have to show us your html structure, there is nothing tere to indicate a loop of any kind
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 10-03-2011, 07:30 AM   PM User | #3
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 794
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
Is this what you mean by html structure?

This is it uptill the links on the shoutbox.

Code:
<body>

<div id="loadHere"></div>


	<div id="container">

			<ul id="navigation">
    
		<center>
        <h1 id="banner"><a href="#">Empire Gammers</a></h1>
		<!-- sponsors -->

		<div id="sponsors">
			
		</div>
        
        
		<div id="main">

			<!-- 
            <div id="advertisement">
				Advert
            </div>
            -->

		<div id="content">

			<div class="news">

           
			<!-- Begin ShoutMix - http://www.shoutmix.com -->

	<div class="blockmid" style="width: 647px; height: 488px;">
		<span class="corners-top"><span></span></span>

			<div style="height: 483px;">
				<h3 class="block-title"><span style="color: rgb(42, 42, 42);">Shoutbox</span></h3>
                <div id="shoutDisplay" style="height: 373px; background-color: rgb(57, 57, 57); width: 617px; margin: 0px auto; padding: 5px; overflow-y: auto; overflow-x: hidden;">
                	<table width="595">
                      <tbody>
                        <tr>
                          <td style="color: rgb(224, 27, 27); padding-bottom: 5px; border-bottom: 1px solid rgb(255, 255, 255); font-size: 1.2em; width: 120px;">SIR SLASH&nbsp;:&nbsp;</td>
                          <td style="padding-bottom: 5px; border-bottom: 1px solid rgb(255, 255, 255); font-size: 1.2em;">Oooo this is looking very sexy haha</td>
                          <td style="padding-bottom: 5px; border-bottom: 1px solid rgb(255, 255, 255); font-size: 0.8em; width: 120px;"><span style="float: right;"> - Sun 11th of Sep at 23:50<br> - <a href="97" class="ban">Ban</a> - <a href="9" class="edit">Edit</a> - <a href="9" onclick="deleteShout()" class="delete">Delete</a>
tomharto is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:09 PM.


Advertisement
Log in to turn off these ads.