+1 vote
in Programming by (270 points)

i am trying like this:

function fun() {
    var result;

        url: '...',
        success: function(response) {
            result = response;
            // return response; // <- tried that one as well

    return result;

var result = fun();

2 Answers

0 votes
by Expert (3.8k points)

you can use these Steps.

  1. Make the AJAX call synchronous (lets call it SJAX).
  2. Restructure your code to work properly with callbacks
0 votes
by Expert (5.1k points)
for the response ..firstly you have to call the particular action of urs url!!..

than you have to generate the response there!

than print the result on your action!.

and youe code must as follow


        $(document).ready(function() {
            $('#source').change(function() {
                var Filter = $(this).val();
                    type: "POST",
                    url: "complete url",
                    data: {Filter: Filter},
                    success: function(result) {


Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated