Multiple ajax call with different url in one function - ajax

In the 1st ajax call I am storing output of a service in a variable. That is working fine. Then I have to use that variable as input in another service, different url. Is it possible to write in same ajax function?
And if possible, then how to do that?

This can be done using promises. In this case you'd have to return a promise from the function.

Related

Is it possible to pass multiple parameters in request url using webhdfs?

Is it possible to pass multiple arguments in url using webhdfs for instance like show below? http://112.128.0.17:9870/webhdfs/v1/user/myuser/file2.txt&file1.txt?op=DELETE&user.name=myuser&createflag=&createparent=true&overwrite=false&recursive=trueObviously it is just an example which doesn't work but maybe there is any way to do this? Or it is needed to send multiple requests?
The answer is no, besides the fact that the URL you created is not even valid.
You will need to issue one request (file operation) at a time.

Use '#' with method in codeigniter like www.mydomain.com/controller#method

Is it possible to call a method of any controller like this:
www.mydomain.com/controller#method
instead of
www.mydomain.com/controller/method
#method(hash) values not detected by PHP, even with $_SERVER["REQUEST_URI"],
So It's not possible. You can detect the hash value with javascript alert(window.location.hash); OR Use ajax to prevent page refresh.

Synchronous AJAX call

In a scenario, I have written a javascript and in middle of the script I made an AJAX call. There is some more amount of script which is present after the AJAX call and this needs to be executed based on the results returned from the function. But Unfortunately the script which is present after the AJAX call is executed before the function call itself, that is, the call is being made asynchronously. Could anyone please suggest me how to overcome this problem?
Thanks in Advance..
Are you using jQuery? IF not, you should :)
Then you should read this documentation - http://api.jquery.com/jQuery.ajax/
And put the rest of the script in the success handler of the ajax function.
If you still insist on not using jQuery, just use the onreadystatechange function
http://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp

How to call an action inside another action in Yii?

I've a situation where i get some information from database and based on the data , i want to do/forward to some other controller & action.
How can i do this using Yii? Its like an ajax request..
If i can use the CController->forward() , then how can use the post values for actions?
I shall assume that the reason why redirect() didn't work for you was because you can't sent post variables with it. If that's the case, then let me show you how to overcome the lack of POST support in redirect(). You can use setState(). It creates variables that simulate POST variables. This is the code to store or set a variable:
Yii::app()->user->setState('var', 'value');
And, in order to trace the value you just code as follows:
Yii::app()->user->getState('param1');
It would equally work with forward, but I'm not sure why you want to use it instead of redirect().

Is it possible to send a form and a html request with same Event by Mootools?

$('submitbutton').addEvent( 'submit', function(e){
e.stop();
$('fuss').send();
req2.send();
});
trying to get this working but not sure if it is possible and had no success so far.
Mootools docs doesnt helped me either.
Will the multiple usage of .send() work?
Do i have to specify the data beeing send for the html request or does it take automatical the data beeing send by the form ?
It's in the documentation: http://mootools.net/docs/core/Request/Request#Element:send
This shorthand method will do a request using the post-processed data from all of the fields.
You can do as many requests in a specific event as you wish, as long as they're all asynchronous.
In your specific example it would seem you want to do two requests using two different methods, one with setting up a new Request class manually and the second doing it via the Element Method.
Based on your last comment, I wrote a little example in jsFiddle.
Basically I think you don't need two request for your goal. Just override onRequest method to update the html.

Resources