I am having some problem to displaying the response getting from the below given code. Please help me to display the response on my page that I am getting from this code:
$(document).ready(function () {
console.log("ready!");
$('#m_p_advc').change(function () {
var sup = $('#m_p_advc').val();
$('#result').html(sup);
$.ajax({
type: 'GET',
url: '../hcshimla/newfiling/ajaxfunction.php',
data: {gadvcd: sup, flag: 'ADV'},
success: function (response) {
$('#result').html(response.first);
}
});
});
});
And here is the screenshot of data that I am receiving through this code:
In this response (data) I want to split every bit of information seperating with "~" (sign) and display them on different textboxes on the form.
With your response you got,split them with ~ and if you want to display the splitted values on different textboxes means loop them inorder to place the value with the respective text boxes.. Here is the sample code for that.. Not sure whether your looking for this kind of an output..
Sample Html:
<input type="text" id="TextBox0" />
<input type="text" id="TextBox1" />
<input type="text" id="TextBox2" />
jQuery:
$(document).ready(function () {
$.ajax({
type: 'GET',
url: '../hcshimla/newfiling/ajaxfunction.php',
data: {gadvcd: sup, flag: 'ADV'},
success: function (response) {
var arr = response.split("~");
for (var i = 0; i <= arr.length; i++)
{
$('#TextBox' + i + '').val(arr[i]);
}
},
error: function (response) {
alert(response);
}
});
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments