Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

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 09-11-2007, 01:45 PM   PM User | #1
mskocabay
New Coder

 
Join Date: Aug 2007
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
mskocabay is an unknown quantity at this point
adding variable to ajax function

Code:
function dosyaSil(silinecekDosya) {
	if( confirm('Dosya Silinsin mi?') ) {
		var sc="yap=sil&dosya="+silinecekDosya;
		JXP(1, "dizin_alani", "cevap.php", sc);
	}
}
this is my ajax fuction takes filename from
Code:
<?php echo '[<a href="javascript:dosyaSil(\''. $res['picture1']. '\');">sil</a>]';?>
but i want added $user_id after $res['picture1']
how can i change php code and function dosyasil ?

thanks
mskocabay is offline   Reply With Quote
Old 09-11-2007, 02:04 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
what is hard about it?

il(\''. $res['picture1']. '\',\''. $res['foo']. '\');

and

dosyaSil(silinecekDosya,foo)

and

var sc="yap=sil&dosya="+silinecekDosya + "&foo=" + foo;

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Users who have thanked A1ien51 for this post:
mskocabay (09-11-2007)
Old 09-11-2007, 02:19 PM   PM User | #3
mskocabay
New Coder

 
Join Date: Aug 2007
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
mskocabay is an unknown quantity at this point
Quote:
Originally Posted by A1ien51 View Post
what is hard about it?

il(\''. $res['picture1']. '\',\''. $res['foo']. '\');

and

dosyaSil(silinecekDosya,foo)

and

var sc="yap=sil&dosya="+silinecekDosya + "&foo=" + foo;

Eric
i try this but i took javascript error

Code:
<?php echo '[<a href="javascript: DosyaSil(\''. $res['picture1']. '\',\''. $res['user_id']. '\');">sil</a>]';?>

<script type="text/javascript">
 function dosyaSil(silinecekDosya,user_id) {
	if( confirm('Dosya Silinsin mi?') ) {
		var sc="yap=sil&dosya="+silinecekDosya + "&user_id=" + user_id;		
		JXP(1, "dizin_alani", "cevap.php", sc);
	}
}
link shortcut seems javascript: DosyaSil('asd.jpg','115');

Last edited by mskocabay; 09-11-2007 at 02:24 PM..
mskocabay is offline   Reply With Quote
Old 09-11-2007, 05:22 PM   PM User | #4
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
What does the following output when you do a view source on the webpage.

<?php echo '[<a href="javascript: DosyaSil(\''. $res['picture1']. '\',\''. $res['user_id']. '\');">sil</a>]';?>

What is the JavaScript error?

Do you use Firefox? If you do, you can install the firebug extension [http://www.getfirebug.com] which will make debugging JavaScript easier.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 09-12-2007, 08:35 AM   PM User | #5
mskocabay
New Coder

 
Join Date: Aug 2007
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
mskocabay is an unknown quantity at this point
Error: DosyaSil is not defined
Kaynak dosya: javascript: DosyaSil('asd.jpg','115');
Hat: 1


Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIWebNavigation.loadURI]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: chrome://global/content/viewSource.js :: viewSource :: line 141" data: no]
mskocabay is offline   Reply With Quote
Old 09-12-2007, 02:58 PM   PM User | #6
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
<?php echo '[<a href="javascript: DosyaSil(\''. $res['picture1']. '\',\''. $res['user_id']. '\');return false;">sil</a>]';?>
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 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 07:51 AM.


Advertisement
Log in to turn off these ads.