Thursday, 30 August 2018
Subscribe to:
Post Comments (Atom)
associative array
in javascript
and passing the values to php
script via ajax
. In javascript, the values are inserted into the array only if two text fields are not empty. When I pass an empty array to php
script and echo the variable in Model, I am getting the output asarray([0]=> )
array(['key1']=>['value1'])
[0]
? My script isif(document.getElementById("insertname").value != null && document.getElementById("insertnumber").value != null)
{var partner_name = new Object();
partner_name[document.getElementById("insertname").value] = document.getElementById("insertnumber").value;
}
$.ajax({
type:"POST",
url:"",
data:{Partner_name:partner_name,cus_id:id,cus_message:customermessage},
success:function(responsee){
alert("Message Sent and Stored");
alert(responsee);
}
});
array(1) {
[0]=>
string(0) ""
}
<script type="text/javascript">
<?php if(count($array) > 0){ ?>
var _array = "<?php $array; ?>"; //put here what you need this is just an example
<?php }else{ ?>
var _array = "";
<?php } ?>
</script>
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment