Cross domain calls in Apps through Javascript

When you try to make a cross domain call to any resource hosted in different domain, then you encounter an issue with browser does not allow to access the resources due to "same-orgin policy". In order to overcome this issue in our javascript we can use the below model using SP.WebProxy. The below sample can be added to the site using CEWP or can be added to your app. Peace!