Achieve Solution
Achieve Solution

Reputation: 190

My ajax call is not working in Chrome and Firefox

Hi My ajax call is not working in chrome and firefox but it is in Safari. I am not able to figure it out as it is working on all browsers locally. My site is recently had SSl certificate.Is that something causing problem? I am not sure. For reference below is my Ajax function

<script type="text/javascript">
//<![CDATA[
$(function () {

$("#selectReport").hide();
$("select#countryId").change(function () {
    var manu = $("#manufacturerId option:selected").text();
    $("#Manufacturer").val(manu);
    $("#selectReport").show();

});

$("select#reportId").change(function (e) {
    e.preventDefault();
    var country = $("#countryId option:selected").text();
    $("#CountryName").val(country);
    });
$("select#reportId").change(function (event) {
    event.preventDefault();
    var reportName = $("#reportId option:selected").text();
    var manufacturer = $("#Manufacturer").val();
    var countryName = $("#CountryName").val();
    var theUrl = "/Reports/GetReport/" + reportName + "/" + manufacturer + "/" + countryName;

    $.ajax({
        url: theUrl,
        type: 'get',
        success: function (data) {
            alert("I am success");
           $('#ajaxOptionalFields').html(data);
        },
        error: function () {
            alert("an error occured here");
        }
    });
});
});
//]]>


</script>

Upvotes: 2

Views: 3632

Answers (2)

Geoffreyirl
Geoffreyirl

Reputation: 126

seems you didn't load the Jquery Lib,

http://jquery.com/download/ download Jquery lib and put it in your js folder and load it.. then it should understand what "$" is... in Jquery i always start script like:

$( document ).ready(function() {
     //do sth here
});

Upvotes: 2

62071072SP
62071072SP

Reputation: 1935

Instead of copying link directly please copy relative paths so that it will be secured. For example copy http://code.highcharts.com/highcharts.js in higncharts.js and point that to relative path.

Upvotes: 0

Related Questions