Link to home
Start Free TrialLog in
Avatar of jasont09
jasont09

asked on

How to Call Stored Procedure and Display Results JavaScript

Hi

I Currently have a stored procedure in ms sql server 2008 which is call from a C# page and returns data into a gridview.

The procedure is named: GetPricesForProduct
and accepts 1 param which is pid this is the product id

so my currect page would call the proc like productdetail.aspx?pid=16612

this would return columns into a gridview
site      Blogcategory      Productname      price

and repeat the data for all rows.

I want to be able to display this data in other sites and would like to call it as a javascript include file.

So I am looking to find out how to call the stored procedure with the param ?pid=16612 and how to output the results into html table using javascript.



Avatar of leakim971
leakim971
Flag of Guadeloupe image

what about something like :
<script type="text/javascript" language="javascript" src="http://www.yourdomain.com/path/to/your/services/Service1.svc/GetProduct?pid=16612"></script>
Avatar of jasont09
jasont09

ASKER

Hi leakim971

Your example shows me how to call it on the page, but I really dont have a clue about javascript and was looking for some guidance on how to call the actual stored procedure in the db and return the results into a javascript file which can then be called from the page using something like your example

can you help me please?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help.