Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Testweb

Выполнить jaix запрос

Recommended Posts

Подкиньте пожалуйста пример запроса. Что та не разберу...

 

 

К примеру есть такой запрос

'?app=core&module=system&controller=ajax&do=instantNotifications&csrfKey=4895a3112df989ba11f9a483540fefb1&notifications=0&messages=0'

 

К какому скрипту он обращается, можно путь полностью? :rolleyes:

Share this post


Link to post

Верный код?

window.onload = function(){
   new Ajax.Request('app=core&module=system&controller=ajax&do=instantNotifications',{
hideLoader: true,
onSuccess: function(t){



   }});
};

Edited by Testweb

Share this post


Link to post

Мужики, подскажите

:mellow:

Share this post


Link to post

Кого? Чего?

'?app=core&module=system&controller=ajax&do=instantNotifications&csrfKey=4895a3112df989ba11f9a483540fefb1&notifications=0&messages=0'

applications/core/modules/front/system/ajax.php

Share this post


Link to post

Дописал

	public function doExecute()
{




    \IPS\Output::i()->json('sds');	

}

 

 

window.onload = function(){
  new Ajax.Request('?app=core&module=system&controller=ajax&do=instantNotifications',{
      hideLoader: true,
      onSuccess: function(t){	
	alert('ff');
      }
  });
};

 

Алерт не получаю, должно все работать.

Share this post


Link to post

От скрипта должен получить ответ "sds", в js должно сработать алерт. В чем допустил ошибку?

Share this post


Link to post

Дописал

    public function doExecute()

    {

        \IPS\Output::i()->json('sds');  

    }

И где Вы нашли метод doExecute?

У Вас в коде вообще запрос идет к instantNotifications

Share this post


Link to post

Как верно составить js код чтобы он работал, сейчас ошибка при запросе.

 

Как составить код использую готовые методы, как в ips делают jaix запросы.

Share this post


Link to post

как в ips делают jaix запросы.

ips.getAjax()(url)
.done(function(){

}).fail(function(){

});

сейчас ошибка при запросе.

Не вижу ошибок

Share this post


Link to post
Как верно составить js код чтобы он работал, сейчас ошибка при запросе.

В /applications/core/modules/front/system/ajax.php:

	public function myFunction()
{
	\IPS\Output::i()->json( array( 'content' => 'My content...' ) );
}

В JS:

	ips.getAjax()( ips.getSetting('baseURL') + 'index.php?app=core&module=system&controller=ajax&do=myFunction', {
	dataType: 'json',
	showLoading: true,
	timeout:  10000
})
.done( function(response) {
	alert(response.content);
})	
.fail( function() {
	alert('Error!');
});

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...