Solved

open url inside of .js

Posted on 2015-02-20
4
44 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 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
 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

803 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