php


JQuery AJAX is encoding API Token for Laravel Application, results in 401 Unauthorized


I have a small application and it has one route that returns JSON. If I use Postman or my browser, I get the correct result. Similarly, if I am running a server on my computer, I get the correct result.
On a live server, however, jQuery is encoding the api token before submitting it, and I'm not getting the result, just a 401 error.
let product_id = $(this).val()
let token = $('input[name=token]').val()
$.ajax({
url: 'api/campaign/',
data: {
'product_id': product_id,
'api_token': token,
},
success: function (data) {
// Do Stuff
}
})

Related Links

Create a simple PHP Array from this text
PHPStorm not able to run .php file (Working as .html file)
Captcha is not working in Yii2
Read ini file in PHP, not parse
Laravel where condition
Select Value from DB Array inside check box input
WordPress Custom Header Repeat and Full Width Options
Symfony is linked to the wrong PHP version
Creating configurations in Symfony
php loop over multidimentional array woocommerce REST API
display all document on php
Need help integrating a script into website
page getting redirected to wrong page
getting error in paypal subscription code, error : 10474
Laravel 5.0 bulk update
PHP Try/Catch exception - Parse.com SDK

Categories

HOME
opengl
orientdb
powerbi
matrix
verification
freeradius
yaml
vagrant
writefile
nsview
ant
magento-2.0
tibco
facebook-android-sdk
angular2-template
sharepoint-online
driver
scrape
game-maker
vimeo
smartgwt
sonata
nullreferenceexception
infrared
pst
coreldraw
eclipse-emf
web-config-transform
plyr
unrar
dnsmasq
matlab-app-designer
listjs
orchardcms-1.8
cargo
llvm-ir
aurelia-http-client
assemblies
utf
notesview
libreoffice-writer
android-5.0-lollipop
redisson
sigsegv
watir-webdriver
portability
test-data
xcode6.4
jsf-2.3
mathml
maven-release-plugin
node.js-connect
deferred-rendering
adp
preferenceactivity
wif4.5
enunciate
m4
ui4j
python-cffi
in-app-billing
ruby-on-rails-4.1
http.client
nastran
dsa
blank-line
gql
shell-extensions
mgwt
jolie
sunos
dmake
jquery-mobile-flipswitch
ecos
git-reset
pageviews
particle-swarm
jmenubar
grails-2.3
virtual-channel
lru
ax
taskkill
prefuse
algol68
haiku
aptitude
eventaggregator
fuzzy-comparison
objectinstantiation

Resources

Encrypt Message