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.
I can provide the php file if someone has an idea.
Thanks in advance.
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.
Code:
<script type="text/javascript">
function removeDiv(id)
{
$("#"+id).fadeOut("slow");
$("#"+id).remove();
}
function cloneIt(cloneId) {
var currentDiv = $("#"+cloneId).parent(".item");
var Id = $(currentDiv).attr("id").match(/[0-9]+/gi);
var nextId = parseInt(Id,10) + 1;
$.get("'._MODULE_DIR_.$this->name.'/ajax.php?id="+nextId, function(data) {$(currentDiv).after(data);});
$("#"+cloneId).remove();
}
//This is what I'd like to do:
function createIt() {
???
}
</script>
Thanks in advance.
Comment