Buddy, I would do this to make it easier to see things in your code.
printf('fnc_eglise_ajaxGet("ajax/deletaPessoaVinculo.php?%s");', http_build_query(array(
'd' => $vinculo->DAT_INICI_VINCU,
'p' => 'PV',
'c' => $vinculo->COD_TIPOX_VINCU
)));
Although some criticize the use of sprintf
and printf
, I prefer to have something that is more organized, and easy to maintain and understand.
The http_build_query
will transform the array
of php into querystring data.
So, it would transform this:
array('nome' => 'Wallace Maxters', 'profissao' => 'Programador PHP')
For this:
nome=Wallace+Maxters&profissao=Programador+PHP
See the code working at IDEONE
The result of my expression would result in the following PHP string:
'fnc_eglise_ajaxGet("ajax/deletaPessoaVinculo.php?d=1&p=PV&c=alguma+coisa");'
PHP and JAVASCRIPT
According to the desire of the author of the question, I elaborated on how the method mentioned above would be used together with the javascript you want.
It would look like this:
$('#btnSalvaDelete').click(function () {
<?php
printf('fnc_eglise_ajaxGet("ajax/deletaPessoaVinculo.php?%s");',
http_build_query(array(
'd' => $vinculo-> DAT_INICI_VINCU,
'p' => 'PV',
'c' => $vinculo-> COD_TIPOX_VINCU,
)
));
?>
});