Solved

open url inside of .js

Posted on 2015-02-20
4
39 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
  • 2
4 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
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
 

Author Comment

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

Expert Comment

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now