0

Hi I was trying to mobilise my website and I ran into an issue with Jquery. When I was trying to perform a jquery call (.$ajax) it was not getting rendered. This is the part of the code

 var returnData = '';
                $.ajax({url: './indexSubmit.php',
                    async: false,
                    dataType: 'json',
                    data:{flag:'vehicleInfo',
                        vehicleId:xVehicleId},
                        success: function(data,textStatus){
                        if(textStatus != 'success'){
                            alert('Error: '+ textStatus);
                            return;
                        }
                        returnData = data;

I am not sure, but I guess I need to install jquery in the browser. If yes, can I automatically download and install jquery in the browser using some javascript?

Sarfraz
  • 377,238
  • 77
  • 533
  • 578
Radhika
  • 35
  • 1
  • 3

2 Answers2

1

Your object is malformed, you are missing a closing brace, paren and semi-colon:

         var returnData = '';
            $.ajax({url: './indexSubmit.php',
                async: false,
                dataType: 'json',
                data:{
                    flag:'vehicleInfo',
                    vehicleId:xVehicleId
                },
                success: function(data,textStatus){
                    if(textStatus != 'success'){
                        alert('Error: '+ textStatus);
                        return;
                    }
                    returnData = data;
                }); // <- this was missing
Dan Heberden
  • 10,990
  • 3
  • 33
  • 29
0

If I get it right, what you need is to include the jquery library so you can use it on your page. Then you need a <script> tag on your html page. The most straightforward way:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

Inside the <head> ... </head> block on your html page. Of course, inside the src attribute you can specify a path inside your own webserver where the jquery.js file is.