Click here to Skip to main content
15,444,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I would really appreciate for any kind of advice!!
Below is a code I am using to make an API call and its not working properly.
Actually the ajax part is not working

HTML
$('#mainContainerMainPage').append('<li class="listitem"> <p class="paddtittle"><a href="https://a2atest.wildcardsystems.com/a2a/CO_LoadValue.asp?userid=xxxxxx&pwd=xxxxx&sourceid=xx&cardnum=xxxxxxxx&purseno=14&amount=10&resp=html"> Confirm Load Value </a>  </p></li>');

above lines works fine what it does is to make a html element dynamically and it creates a an html element with heref link which is when pressed makes an API call
and the response I get is in html or xml format but the problem is I cannot grab the response and show that in a customized format. so I tried another way which is ajax call for the api call to grab the response and use further but its not working no response I don't know if I am doing some thing wrong or there is some other way of doing it. Can you help me make a proper ajax call and grab the results?.


Code starts here
JavaScript
$(document).ready(function() {

$('#makecall').click( function() {

$('#mainContainerMainPage').append('<li class="listitem"> <p class="paddtittle"><a href="https://a2atest.wildcardsystems.com/a2a/CO_LoadValue.asp?userid=xxxxxx&pwd=xxxxx&sourceid=xx&cardnum=xxxxxxxx&purseno=14&amount=10&resp=html"> Confirm Load Value </a>  </p></li>');


$.ajax(
{
url:'https://a2atest.wildcardsystems.com/a2a/CO_LoadValue.asp?',
type:'POST',
data: {userid:'xxxxxxxx', &pwd:'xxxxxxx',&sourceid:'xx',&cardnum:'xxxxxxxxx',&purseno:'14',&amount:'10',&resp:'html'},
success: function(data)
{


$('#mainContainerMainPage').append(data);},

error: function(data)
{


$('#mainContainerMainPage').append(data);}

});


});

Thanks! in Advance
Posted
Updated 10-Aug-12 11:30am
v3
Comments
Sergey Alexandrovich Kryukov 10-Aug-12 17:57pm     CRLF
Generally, it's not possible to see why there is no response without seeing a server-part code. --SA
ankitrishi8584 10-Aug-12 20:03pm     CRLF
I have tried this too still not getting any response

1 solution

You are creating a link, and then making an ajax call. your link does not make an ajax call. have you looked at the error data passed in to the browser from your AJAX call, assuming there is an error ?
 
Share this answer
 
Comments
ankitrishi8584 13-Aug-12 19:45pm     CRLF
Hi Christian Thanks for the reply. I have a link because just want to see the result without ajax. Below the link code there is an ajax call which doesn't give any response no errors nothing. This ajax code works fine if called locally!! my web browsers have ssl certificates installed and it gives the results if make link and also if type in to the web browser. If there are no ssl certificates it gives error. Ajax doesn't give any response, I think simple ajax doesn't support cross domain calls. I don't know how to make an API and a proxy ajax call ??
Christian Graus 16-Aug-12 13:33pm    
I am not sure, but why does your call need to be cross domain ? Does the error part of your code get called ? Does the error tell you anything ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900