Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

open url inside of .js

Posted on 2015-02-20
4
Medium Priority
?
54 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 84

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 2000 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 84

Expert Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

688 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