473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

how to create "add" javascript function using existing "delete" function

Hello,
I have existing code working perfectly, which can :
-clone existing datas (title, textarea, link-to-picture) contained in xml file, and :
-delete datas.

I looking for a javascript code to "Create" the first data sample, because "clone" uses the last datas in the .xml file, and obviously is not proper if xml file is empty.

Here is my code.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <script type="text/javascript">
  3.  
  4. function removeDiv(id)
  5. {
  6. $("#"+id).fadeOut("slow");
  7. $("#"+id).remove();
  8. }
  9.  
  10. function cloneIt(cloneId) {
  11. var currentDiv = $("#"+cloneId).parent(".item");
  12. var Id = $(currentDiv).attr("id").match(/[0-9]+/gi);
  13. var nextId = parseInt(Id,10) + 1;
  14. $.get("'._MODULE_DIR_.$this->name.'/ajax.php?id="+nextId, function(data) {$(currentDiv).after(data);});
  15. $("#"+cloneId).remove();
  16. }
  17.  
  18. //This is what I'd like to do:
  19. function createIt() {
  20. ???
  21. }
  22. </script>
  23.  
I can provide the php file if someone has an idea.
Thanks in advance.
Jul 1 '10 #1
2 1720
RamananKalirajan
608 512MB
Hi,
Are you looking for this.

Thanks and Regards
Ramanan Kalirajan
Jul 2 '10 #2
Hi,
Not at all Ramanan.
Your example is simply for inserting and deketing a row.
Too simple Ramanan!

Mine is to clone or delete some information included in an xml file and updated by another function.

Thanks anyway Ramanan!
Jul 5 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bruce | last post by:
I have three tables in SQL serve tblareas (w/autoincrement ID tblprograms (w/autoincrement ID tblphases (w/autoincrement ID I've build cascading relation from tblareas <one-many> tblprograms...
2
by: aiKeith | last post by:
I have a really stupid problem I'm hoping to get help with. The problem occurs if I delete rows from a dynamically built datatable. ie: CreateDataTable(); // creates the structure of the...
4
by: Melissa | last post by:
I have a frontend file named CustomerApp and backend file named CustomerData. CustomerApp is at C:\Customer Database and CustomerData is at S:\Customer Database. Could someone help me with the code...
0
by: phmyhn | last post by:
I have two web pages, one is viewlarger.aspx, another one is shoppingcart.aspx. On the viewlarger.aspx, when clicking "add to cart" image button, the sub appends the id (passed from another page...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
40
by: Mark P | last post by:
I'm implementing an algorithm and the computational flow is a somewhat deep. That is, fcn A makes many calls to fcn B which makes many calls to fcn C, and so on. The return value of the outermost...
7
by: Alex Maghen | last post by:
I have a DataGrid control with a LinkButton command column that deletes the row. What I want to do is set it up so that there's a client-side Confirm alert BEFORE the actual Delete command gets...
2
by: jphelan | last post by:
I was testing the install and uninstall, on my WindowsXP Pro SP2 machine, of software that I created, called, "inbusiness". Because of the following error message that I received on attempting to...
3
rsmccli
by: rsmccli | last post by:
Using AC2002 Hello. I am working with an existing DB that has "Add New" command buttons on two forms. When I, an Admin, click the buttons, they work properly, and a new, blank form is created,...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.