View Single Post
  #3  
Old 03-17-2017, 06:47 AM
 
ajeetsingh ajeetsingh is offline
 

Member
  
Join Date: Dec 2016
Posts: 28
 

Default Re: Issue in calling an ajax request in admin area.

Hello qualiteam,

As you suggest about to use admin url i have done same but my issue is remain same. the code is as below :
PHP Code:
<script>
jQuerydocument ).ready(function() {    
  var 
wkUrldds self.location;        
  var 
wkUrl=wkUrldds+'skins/admin/modules/Webkulsoftware/WebPushNotification/notify.php';    
        
jQuery('body').on('click','.notifybtn',function(){
            var 
idss jQuery(this).val();
            var 
urll jQuery('form').attr('action');
            
sendPushNotification(idssurll);
        });

        function 
sendPushNotification(idssurll){
            
            
jQuery.ajax({
                
urlurll+'?target=notif_tmplts&action=notify',
                
data: {ididss,urllurll},
                
type'POST',
                
success: function (data) {
                    if(
data != ''){
                        
console.log(data);
                    }else{
                         
console.log('Not a valid data');
                    }                   
                }
            });
        }

    });
    </
script


And the controller function is as below:

PHP Code:
protected function doActioNotify(){
    
$tpId = \XLite\Core\Request::getInstance()->nIds;
    echo 
$tpId


In that case the ajax call is done but when i click on the ajax url in console then it redirect on the page where a notice is appear that i have no permission to access that page. I have also provide the snapshot of that page below;
Attached Thumbnails
Click image for larger version

Name:	screenshot-ajeet.com-2017-03-17-20-16-22.png
Views:	76
Size:	58.8 KB
ID:	4877  
__________________
Ajeet Singh
Sr.Software Developer
Webkul Software Pvt. Ltd.
Reply With Quote