2
var httpOptions = {
    url: "http://doman/files",
    method: "GET",
    params : {
        type: pdf,
        page: '112',
        country: "USA",
        lang: "en"                    
    }
};

$http(httpOptions).success(function(data){  });

I am using angularjs. I have an http options to send server. But I want to get the parsed url after succes like this, because I have a lat of params and not want do manually:

http://mydoman/files?type=pdf&page=112&country=USA&lang=en
10
  • What kind of parsed url do you mean? Something like this: mydoman/files/pdf/112/USA/en ? If yes, you can parse on server side and return in data. Commented Aug 11, 2014 at 13:29
  • like this htt://mydoman/files?type=pdf&page=112&country=USA&lang=en Commented Aug 11, 2014 at 13:44
  • Do you use jQuery for your project? Commented Aug 11, 2014 at 13:46
  • just change type: pdf, to type: 'pdf', Commented Aug 11, 2014 at 13:47
  • I am using angularjs not Jquery Commented Aug 11, 2014 at 13:51

1 Answer 1

1

That is so easy to do with JQuery.param(). If you have JQuery in your project, you can simply use line below :

httpOptions.url + '/?' + $.param(httpOptions.params);

And please do not forget to fix the property type: pdf to type: 'pdf'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.