skip to Main Content

How to send php variable to AJAX – Jquery

I need to retrieve session variable data inside an ajax call. Here is my try. $('#update').click(function(){ var number = $('#num').val(); var curuser = <?php echo $_SESSION['userName'];?> if( number != '' && number.length==9 ) { $.ajax({ data:{number:number}, success:function(data){ $('#number_add').val(number); $('#new_data_Modal').modal('show'); }…

VIEW QUESTION

Ajax Call to ASP.NET MVC controller – Jquery ajax

The jQuery code is : var props = [ { "Name": "firstName", "Value": "firstValue" }, { "Name": "secondName", "Value": "secondValue" } ]; $.ajax({ url: '/myURL', contentType: "application/json", async: true, type: "POST", data: JSON.stringify(props), error: function (jqXHR, textStatus, errorThrown) { console.log("FAIL:…

VIEW QUESTION
Back To Top
Search