2

I'm developing my custom component and I need to call some task from back-end controller during editing a single record. The url of my record edit page in the back-end is:

.../administrator/index.php?option=com_mycom&view=page&layout=edit&id=2

There is my ajax-query for calling a task in the record controller:

$.ajax({
 method: "POST",
 cache: false,
 url: 'index.php?option=com_mycom&task=deleteimg&format=raw&id=<?php echo $this->item->id; ?>',
 data: {id: '<?php echo $this->item->id; ?>'}
}).done(function() {
 alert('Deleted');
});
return false;

I tried also the urls:

index.php?option=com_mycom&controller=record&task=deleteimg&format=raw&id=...
index.php?option=com_mycom&controller=record&view=record&layout=edit&task=deleteimg&format=raw&id=...

But every time console displays me the 404 error:

POST ...//domain.com/administrator/index.php?...&id=2 404 (... [name, type, prefix]: pages, raw, mycomView)

What the correct url should be?

3

Try this one:

index.php?option=com_mycom&task=yourcontroller.deleteimg&tmpl=component&id=<?php echo $this->item->id; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.