Solved

open url inside of .js

Posted on 2015-02-20
4
47 Views
Last Modified: 2015-03-12
I have abc.js and I want to call webservice inside of .js

like I want to call web services  '../RestService/QuoteService/GetModelList(066,315217)';

and so it will return data inside of the abc.js.

Is it possible?
0
Comment
Question by:ITsolutionWizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40621998
You can use AJAX to return the data to a variable.   http://www.w3schools.com/ajax/default.asp  Most examples show returning the data to a 'div' or some other HTML element but a variable will work just as well.
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 40622092
if possible, use jquery's built-in ajax function, it'll be a lot easier to use:

$.ajax({
  url: '../RestService/QuoteService/GetModelList(066,315217)'
}).done(function( theResponse ) {
  var yourVariable = theResponse
});

Open in new window

0
 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 40622509
no. both responses do not help. I need the way I asked. Let me know if you know how to do it.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40622525
AJAX is the only way that javascript can get data from a web site.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question