I have created a function to get sms message
from db using ajax get call
and after success i want to replace the {order_id}
text to order-id like 454574
and may b few more variables like customer name etc.
MY TRY
$(document).delegate('.sms-template', 'click', function() {
var tempID = $(this).attr('id').replace('sms-template-','');
var oID = $(this).attr('data-id').replace('sms-template-','');
$.ajax({
url: 'index.php?route=sale/order/getSmsTemplate&token=<?php echo $token; ?>&template_id='+tempID,
type: 'get',
dataType: 'json',
success: function(json) {
$('textarea#input-order-comment-'+oID).append(json['message']);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
It works fine and display message
in textarea
as
Dear {customer_name}, Your Order : {order_id} is successfully placed and ready to process.
i want to replace {customer_name} & {order_id} with its number which i have stored in php variable.
PS: I don't have much knowledge of RegEx.